Esempio n. 1
0
        public void RotationMatrix3d_RotateRotateVector_Expected(string origin, string axis, double angle, string expected)
        {
            // Prepare
            Cartesian3dCoordinate o = new Cartesian3dCoordinate(origin);
            Cartesian3dCoordinate a = new Cartesian3dCoordinate(axis);
            Cartesian3dCoordinate e = new Cartesian3dCoordinate(expected);
            RotationMatrix3d      m = new RotationMatrix3d(a, angle);

            // Execute
            Cartesian3dCoordinate r = m.Rotate(o);

            // Verify
            Assert.Equal(e.X, r.X, PRECISION_DOUBLE);
            Assert.Equal(e.Y, r.Y, PRECISION_DOUBLE);
            Assert.Equal(e.Z, r.Z, PRECISION_DOUBLE);
        }
Esempio n. 2
0
        public void RotationMatrix3d_SumDifferentRotationAndRotateVector_Expected(string origin, string axis, double angle, string axis2, double angle2, string expected)
        {
            // Prepare
            Cartesian3dCoordinate o      = new Cartesian3dCoordinate(origin);
            Cartesian3dCoordinate a      = new Cartesian3dCoordinate(axis);
            Cartesian3dCoordinate a2     = new Cartesian3dCoordinate(axis2);
            Cartesian3dCoordinate e      = new Cartesian3dCoordinate(expected);
            RotationMatrix3d      first  = new RotationMatrix3d(a, angle);
            RotationMatrix3d      second = new RotationMatrix3d(a2, angle2);

            // Execute
            RotationMatrix3d      m = first.Rotate(second);
            Cartesian3dCoordinate r = m.Rotate(o);

            // Verify
            Assert.Equal(e.X, r.X, PRECISION_DOUBLE);
            Assert.Equal(e.Y, r.Y, PRECISION_DOUBLE);
            Assert.Equal(e.Z, r.Z, PRECISION_DOUBLE);
        }