Esempio n. 1
0
        public static Matrix CreateShear(Shear3D shear)
        {
            Matrix result = Identity;

            result.M11 = 1;
            result.M12 = shear.XY;
            result.M13 = shear.XZ;
            result.M14 = 0;
            result.M21 = shear.YX;
            result.M22 = 1;
            result.M23 = shear.YZ;
            result.M24 = 0;
            result.M31 = shear.ZX;
            result.M32 = shear.ZY;
            result.M33 = 1;
            result.M34 = 0;
            result.M41 = 0;
            result.M42 = 0;
            result.M43 = 0;
            result.M44 = 1;

            return(result);
        }
Esempio n. 2
0
        public static Matrix CreateTransform(Vector3 origin, Vector3 position, Quaternion rotation, Vector3 scale, Shear3D shear)
        {
            Matrix transformMatrix = Identity;

            if (origin != Vector3.Zero)
            {
                transformMatrix *= CreateTranslation(-origin);
            }

            if (shear != Shear3D.Identity)
            {
                transformMatrix *= CreateShear(shear);
            }

            if (scale != Vector3.One)
            {
                transformMatrix *= CreateScale(scale);
            }

            if (rotation != Quaternion.Identity)
            {
                transformMatrix *= rotation.Matrix;
            }

            if (position != Vector3.Zero)
            {
                if (origin != Vector3.Zero)
                {
                    transformMatrix *= CreateTranslation(position - origin);
                }
                else
                {
                    transformMatrix *= CreateTranslation(position);
                }
            }

            if (origin != Vector3.Zero)
            {
                transformMatrix *= CreateTranslation(origin);
            }

            return(transformMatrix);
        }
Esempio n. 3
0
 public bool Equals(Shear3D shear3D)
 {
     return(this == shear3D);
 }