public void SimpleTranslationTest()
        {
            Float3 p = new Float3(1, 3, 7);
            Float3 t = new Float3(1, 2, 3);

            Float4x4 M = new Float4x4(1  , 0  , 0  , 0,
                                      0  , 1  , 0  , 0,
                                      0  , 0  , 1  , 0,
                                      t.x, t.y, t.z, 1);

            Float4x4 M2 = Float4x4.getTranslationMatrix(t);

            Assert.AreEqual(M, M2);
            Assert.AreEqual(p + t, M.transformPoint(p));
            Assert.AreEqual(p + t, M2.transformPoint(p));
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            if (!(obj is Float4x4))
            {
                return(false);
            }
            Float4x4 B = (Float4x4)obj;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    if (!_m[i, j].Equals(B[i, j]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }