Пример #1
0
        public void Inverse()
        {
            Matrix3x3f m = new Matrix3x3f((float)1, (float)0, (float)0,
                                          (float)2, (float)2, (float)3,
                                          (float)0, (float)5, (float)3);

            m = m.Inverse;

            Assert.IsTrue(
                Matrix3x3f.NearEqual(m, new Matrix3x3f(
                                         (float)1, (float)0, (float)0,
                                         (float)2.0 / (float)3.0, -1.0f / (float)3.0, 1.0f / (float)3.0,
                                         (float)-10.0 / (float)9.0, (float)5.0 / (float)9.0, (float)-2.0 / (float)9.0)));
        }
Пример #2
0
        public void Multiplication2()
        {
            Matrix3x3f m = new Matrix3x3f((float)1, (float)0, (float)0,
                                          (float)2, (float)2, (float)3,
                                          (float)0, (float)5, (float)3);

            Matrix3x3f m_inv = new Matrix3x3f(
                (float)1, (float)0, (float)0,
                (float)2.0 / (float)3.0, -1.0f / (float)3.0, 1.0f / (float)3.0,
                (float)-10.0 / (float)9.0, (float)5.0 / (float)9.0, (float)-2.0 / (float)9.0);

            Matrix3x3f r = m * m_inv;

            Assert.IsTrue(Matrix3x3f.NearEqual(r, Matrix3x3f.Identity));
        }
Пример #3
0
 /// <summary>
 /// We solve the system of equations, defined as:
 /// M * X = C.
 /// </summary>
 /// <param name="S">The system in matrix form.</param>
 /// <param name="C">constants</param>
 /// <returns></returns>
 public static Vector3f SolveSystem(Matrix3x3f S, Vector3f C)
 {
     return(S.Inverse * C);
 }