Ejemplo n.º 1
0
        public void RotationMatrix_ToQuaternion_ToRotationMatrix()
        {
            RotationMatrix m1, m2;
            Quaternion     q;
            Vector         vecX, vecY;
            int            dir;

            double[] r = new double[9];

            for (var i = 0; i < 100; i++)
            {
                vecX = Vector.RandomFromDoubles(-100, 100);
                vecY = Vector.RandomFromDoubles(-100, 100);
                dir  = Vector.CompareDirections(vecX, vecY);

                m1 = new RotationMatrix(vecX, vecY);
                q  = m1.ToQuaternion();
                m2 = q.ToRotationMatrix();

                Trace.WriteLine("");
                Trace.WriteLine(vecX + " " + vecY + " dir:" + dir);
                Trace.WriteLine(m1);
                Trace.WriteLine(q);
                Trace.WriteLine(m2);

                Assert.IsTrue(m1.IsSimilar(m2));
            }
        }
Ejemplo n.º 2
0
        public void RotationMatrix_ToQuaternion_LowTrace()
        {
            RotationMatrix m  = new RotationMatrix(new Vector(0, 1, 0), new Vector(-1, 0, 0));
            Quaternion     q  = m.ToQuaternion();
            RotationMatrix m1 = q.ToRotationMatrix();

            Assert.IsTrue(m.IsSimilar(m1));
        }