Пример #1
0
        public bool TryGetInverse(out Matrix3F inverse)
        {
            var inverter   = new GaussJordanInverter <Matrix3F, float>(new Matrix3F(this), CreateIdentity());
            var successful = inverter.Invert();

            inverse = inverter.Inverse;
            return(successful);
        }
Пример #2
0
        public static Matrix3F CreateRotationZ(float radians)
        {
            var result = new Matrix3F
            {
                E22 = 1.0f,
                E00 = (float)Math.Cos(radians),
                E01 = (float)Math.Sin(radians)
            };

            result.E10 = -result.E01;
            result.E11 = result.E00;

            return(result);
        }
Пример #3
0
        public static Matrix3F CreateRotationY(float radians)
        {
            var result = new Matrix3F
            {
                E11 = 1.0f,
                E00 = (float)Math.Cos(radians),
                E20 = (float)Math.Sin(radians)
            };

            result.E02 = -result.E20;
            result.E22 = result.E00;

            return(result);
        }
Пример #4
0
        public static Matrix3F CreateRotationX(float radians)
        {
            var result = new Matrix3F
            {
                E00 = 1.0f,
                E11 = (float)Math.Cos(radians),
                E12 = (float)Math.Sin(radians)
            };

            result.E21 = -result.E12;
            result.E22 = result.E11;

            return(result);
        }
Пример #5
0
        private void CopyFrom(Matrix3F source)
        {
#if HAS_CODECONTRACTS
            Requires(source != null);
#endif
            E00 = source.E00;
            E01 = source.E01;
            E02 = source.E02;
            E10 = source.E10;
            E11 = source.E11;
            E12 = source.E12;
            E20 = source.E20;
            E21 = source.E21;
            E22 = source.E22;
        }
Пример #6
0
        public static Matrix3F CreateRotation(Vector2F origin, float radians)
        {
            var result = new Matrix3F
            {
                E22 = 1.0f,
                E00 = (float)Math.Cos(radians),
                E01 = (float)Math.Sin(radians)
            };

            result.E10 = -result.E01;
            result.E11 = result.E00;
            result.E20 = origin.X - (result.E00 * origin.X) + (result.E01 * origin.Y);
            result.E21 = origin.Y - (result.E01 * origin.X) - (result.E00 * origin.Y);

            return(result);
        }
Пример #7
0
 public bool Equals(Matrix3F other)
 {
     return(object.ReferenceEquals(this, other) ||
            (
                !object.ReferenceEquals(null, other) &&
                E00.Equals(other.E00) &&
                E01.Equals(other.E01) &&
                E02.Equals(other.E02) &&
                E10.Equals(other.E10) &&
                E11.Equals(other.E11) &&
                E12.Equals(other.E12) &&
                E20.Equals(other.E20) &&
                E21.Equals(other.E21) &&
                E22.Equals(other.E22)
            ));
 }
Пример #8
0
        public Matrix3F(Matrix3F source)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            E00 = source.E00;
            E01 = source.E01;
            E02 = source.E02;
            E10 = source.E10;
            E11 = source.E11;
            E12 = source.E12;
            E20 = source.E20;
            E21 = source.E21;
            E22 = source.E22;
        }
Пример #9
0
        public Matrix3F GetProduct(Matrix3F right)
        {
            if (right == null)
            {
                throw new ArgumentNullException(nameof(right));
            }

            return(new Matrix3F
            {
                E00 = (E00 * right.E00) + (E01 * right.E10) + (E02 * right.E20),
                E01 = (E00 * right.E01) + (E01 * right.E11) + (E02 * right.E21),
                E02 = (E00 * right.E02) + (E01 * right.E12) + (E02 * right.E22),
                E10 = (E10 * right.E00) + (E11 * right.E10) + (E12 * right.E20),
                E11 = (E10 * right.E01) + (E11 * right.E11) + (E12 * right.E21),
                E12 = (E10 * right.E02) + (E11 * right.E12) + (E12 * right.E22),
                E20 = (E20 * right.E00) + (E21 * right.E10) + (E22 * right.E20),
                E21 = (E20 * right.E01) + (E21 * right.E11) + (E22 * right.E21),
                E22 = (E20 * right.E02) + (E21 * right.E12) + (E22 * right.E22)
            });
        }
Пример #10
0
        public Matrix3F GetDifference(Matrix3F other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            return(new Matrix3F
            {
                E00 = E00 - other.E00,
                E01 = E01 - other.E01,
                E02 = E02 - other.E02,
                E10 = E10 - other.E10,
                E11 = E11 - other.E11,
                E12 = E12 - other.E12,
                E20 = E20 - other.E20,
                E21 = E21 - other.E21,
                E22 = E22 - other.E22
            });
        }
Пример #11
0
        public Matrix3F GetSum(Matrix3F other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            return(new Matrix3F
            {
                E00 = other.E00 + E00,
                E01 = other.E01 + E01,
                E02 = other.E02 + E02,
                E10 = other.E10 + E10,
                E11 = other.E11 + E11,
                E12 = other.E12 + E12,
                E20 = other.E20 + E20,
                E21 = other.E21 + E21,
                E22 = other.E22 + E22
            });
        }