Пример #1
0
        public static IndexedMatrix CreateScale(float x, float y, float z)
        {
            IndexedMatrix IndexedMatrix = IndexedMatrix.Identity;

            IndexedMatrix._basis = IndexedBasisMatrix.CreateScale(new IndexedVector3(x, y, z));
            return(IndexedMatrix);
        }
Пример #2
0
        public static IndexedMatrix CreateScale(IndexedVector3 scales)
        {
            IndexedMatrix result = IndexedMatrix.Identity;

            result._basis = IndexedBasisMatrix.CreateScale(scales);
            return(result);
        }
 public IndexedBasisMatrix TimesTranspose(IndexedBasisMatrix m)
 {
     return(new IndexedBasisMatrix(
                _el0.Dot(m._el0), _el0.Dot(m._el1), _el0.Dot(m._el2),
                _el1.Dot(m._el0), _el1.Dot(m._el1), _el1.Dot(m._el2),
                _el2.Dot(m._el0), _el2.Dot(m._el1), _el2.Dot(m._el2)));
 }
Пример #4
0
        public static IndexedMatrix CreateScale(float scale)
        {
            IndexedMatrix result = IndexedMatrix.Identity;

            result._basis = IndexedBasisMatrix.CreateScale(new IndexedVector3(scale));
            return(result);
        }
        public static IndexedBasisMatrix CreateFromAxisAngle(IndexedVector3 axis, float angle)
        {
            float num1             = axis.X;
            float num2             = axis.Y;
            float num3             = axis.Z;
            float num4             = (float)Math.Sin((double)angle);
            float num5             = (float)Math.Cos((double)angle);
            float num6             = num1 * num1;
            float num7             = num2 * num2;
            float num8             = num3 * num3;
            float num9             = num1 * num2;
            float num10            = num1 * num3;
            float num11            = num2 * num3;
            IndexedBasisMatrix ibm = new IndexedBasisMatrix(num6 + num5 * (1f - num6),
                                                            (float)((double)num9 - (double)num5 * (double)num9 + (double)num4 * (double)num3),
                                                            (float)((double)num10 - (double)num5 * (double)num10 - (double)num4 * (double)num2),
                                                            (float)((double)num9 - (double)num5 * (double)num9 - (double)num4 * (double)num3),
                                                            num7 + num5 * (1f - num7),
                                                            (float)((double)num11 - (double)num5 * (double)num11 + (double)num4 * (double)num1),
                                                            (float)((double)num10 - (double)num5 * (double)num10 + (double)num4 * (double)num2),
                                                            (float)((double)num11 - (double)num5 * (double)num11 - (double)num4 * (double)num1),
                                                            num8 + num5 * (1f - num8));

            return(ibm);
        }
        public static IndexedBasisMatrix CreateRotationY(float radians)
        {
            float num1             = (float)Math.Cos((double)radians);
            float num2             = (float)Math.Sin((double)radians);
            IndexedBasisMatrix ibm = new IndexedBasisMatrix(num1, 0.0f, -num2, 0.0f, 1f, 0.0f, num2, 0.0f, num1);

            return(ibm);
        }
Пример #7
0
        public static IndexedMatrix CreateRotationZ(float radians)
        {
            IndexedMatrix IndexedMatrix;

            IndexedMatrix._basis  = IndexedBasisMatrix.CreateRotationZ(radians);
            IndexedMatrix._origin = new IndexedVector3(0, 0, 0);

            return(IndexedMatrix);
        }
        public static void CreateRotationZ(float radians, out IndexedBasisMatrix _basis)
        {
            float num1 = (float)Math.Cos((double)radians);
            float num2 = (float)Math.Sin((double)radians);

            _basis._el0 = new IndexedVector3(num1, num2, 0);
            _basis._el1 = new IndexedVector3(-num2, num1, 0);
            _basis._el2 = new IndexedVector3(0, 0, 1);
        }
Пример #9
0
        public IndexedMatrix InverseTimes(ref IndexedMatrix t)
        {
            IndexedVector3 v  = new IndexedVector3(t._origin.X - _origin.X, t._origin.Y - _origin.Y, t._origin.Z - _origin.Z);
            IndexedVector3 v2 = new IndexedVector3();

            IndexedBasisMatrix.Multiply(ref v2, ref _basis, ref v);
            return(new IndexedMatrix(_basis.TransposeTimes(ref t._basis),
                                     v * _basis));
        }
 public IndexedBasisMatrix TransposeTimes(ref IndexedBasisMatrix m)
 {
     return(new IndexedBasisMatrix(
                _el0.X * m._el0.X + _el1.X * m._el1.X + _el2.X * m._el2.X,
                _el0.X * m._el0.Y + _el1.X * m._el1.Y + _el2.X * m._el2.Y,
                _el0.X * m._el0.Z + _el1.X * m._el1.Z + _el2.X * m._el2.Z,
                _el0.Y * m._el0.X + _el1.Y * m._el1.X + _el2.Y * m._el2.X,
                _el0.Y * m._el0.Y + _el1.Y * m._el1.Y + _el2.Y * m._el2.Y,
                _el0.Y * m._el0.Z + _el1.Y * m._el1.Z + _el2.Y * m._el2.Z,
                _el0.Z * m._el0.X + _el1.Z * m._el1.X + _el2.Z * m._el2.X,
                _el0.Z * m._el0.Y + _el1.Z * m._el1.Y + _el2.Z * m._el2.Y,
                _el0.Z * m._el0.Z + _el1.Z * m._el1.Z + _el2.Z * m._el2.Z));
 }
Пример #11
0
        public IndexedMatrix Inverse()
        {
            IndexedBasisMatrix inv = _basis.Transpose();

            return(new IndexedMatrix(inv, inv * -_origin));
        }
Пример #12
0
 public static void CreateRotationZ(float radians, out IndexedMatrix result)
 {
     result._basis  = IndexedBasisMatrix.CreateRotationZ(radians);
     result._origin = new IndexedVector3(0, 0, 0);
 }
Пример #13
0
 public static void CreateScale(float scale, out IndexedMatrix result)
 {
     result        = IndexedMatrix.Identity;
     result._basis = IndexedBasisMatrix.CreateScale(new IndexedVector3(scale));
 }
Пример #14
0
 public static void CreateScale(ref IndexedVector3 scales, out IndexedMatrix result)
 {
     result        = IndexedMatrix.Identity;
     result._basis = IndexedBasisMatrix.CreateScale(scales);
 }
 public static void Multiply(ref IndexedVector3 vout, ref IndexedVector3 vin, ref IndexedBasisMatrix m)
 {
     vout = new IndexedVector3(m.TDotX(ref vin), m.TDotY(ref vin), m.TDotZ(ref vin));
 }
Пример #16
0
 public IndexedMatrix(Microsoft.Xna.Framework.Matrix m)
 {
     _origin = new IndexedVector3(m.Translation);
     //_basis = new IndexedBasisMatrix(new IndexedVector3(m.Right), new IndexedVector3(m.Up), new IndexedVector3(m.Backward)).Transpose();
     _basis = new IndexedBasisMatrix(new IndexedVector3(m.Right), new IndexedVector3(m.Up), new IndexedVector3(m.Backward));
 }
 public static void Transpose(ref IndexedBasisMatrix IndexedMatrix, out IndexedBasisMatrix result)
 {
     result = new IndexedBasisMatrix(IndexedMatrix._el0.X, IndexedMatrix._el1.X, IndexedMatrix._el2.X,
                                     IndexedMatrix._el0.Y, IndexedMatrix._el1.Y, IndexedMatrix._el2.Y,
                                     IndexedMatrix._el0.Z, IndexedMatrix._el1.Z, IndexedMatrix._el2.Z);
 }
Пример #18
0
 public IndexedMatrix(float m11, float m12, float m13, float m21, float m22, float m23, float m31, float m32, float m33, float m41, float m42, float m43)
 {
     _basis  = new IndexedBasisMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
     _origin = new IndexedVector3(m41, m42, m43);
 }
 public static void Multiply(ref IndexedVector3 vout, ref IndexedBasisMatrix m, ref IndexedVector3 v)
 {
     vout = new IndexedVector3(m._el0.X * v.X + m._el0.Y * v.Y + m._el0.Z * v.Z,
                               m._el1.X * v.X + m._el1.Y * v.Y + m._el1.Z * v.Z,
                               m._el2.X * v.X + m._el2.Y * v.Y + m._el2.Z * v.Z);
 }
Пример #20
0
 public IndexedMatrix(IndexedBasisMatrix basis, IndexedVector3 origin)
 {
     _basis  = basis;
     _origin = origin;
 }
 public static IndexedBasisMatrix Transpose(IndexedBasisMatrix IndexedMatrix)
 {
     return(new IndexedBasisMatrix(IndexedMatrix._el0.X, IndexedMatrix._el1.X, IndexedMatrix._el2.X,
                                   IndexedMatrix._el0.Y, IndexedMatrix._el1.Y, IndexedMatrix._el2.Y,
                                   IndexedMatrix._el0.Z, IndexedMatrix._el1.Z, IndexedMatrix._el2.Z));
 }