Ejemplo n.º 1
0
        public void Spatial()
        {
            var par1 = new CFrame(1, 2, 3) * CFrame.Angles(4, 5, 6);
            var par2 = new CFrame(4, 5, 6) * CFrame.Angles(1, 2, 3);

            var expected1 = new CFrame(2.284338f, -3.74210596f, -2.78898597f, -0.723131239f, -0.25124836f, 0.643393695f,
                                       -0.223633111f, 0.966485798f, 0.126068801f, -0.653505504f, -0.0527198762f, -0.755083561f);
            var actual1 = par1.toObjectSpace(par2);

            Assert.AreEqual(expected1, actual1, "toObjectSpace did not return expected results.");

            var expected2 = new CFrame(-3.26779175f, 4.68169117f, -4.18292999f, -0.522057056f, 0.697389245f,
                                       0.491024077f, 0.781638145f, 0.160808325f, 0.602646112f, 0.341318101f, 0.698418856f, -0.629057229f);
            var actual2 = par1.toWorldSpace(par2);

            Assert.AreEqual(expected2, actual2, "toWorldSpace did not return expected results.");

            var expected3 = new Vector3(2.284338f, -3.74210548f, -2.78898621f);
            var actual3   = par1.pointToObjectSpace(par2.p);

            Assert.AreEqual(expected3, actual3, "pointToObjectSpace did not return expected results.");

            var expected4 = new Vector3(-3.26779175f, 4.68169117f, -4.18292999f);
            var actual4   = par1.pointToWorldSpace(par2.p);

            Assert.AreEqual(expected4, actual4, "pointToWorldSpace did not return expected results.");

            var expected5 = new Vector3(3.14449883f, -7.21789789f, -3.87479973f);
            var actual5   = par1.vectorToObjectSpace(par2.p);

            Assert.AreEqual(expected5, actual5, "vectorToObjectSpace did not return expected results.");

            var expected6 = new Vector3(-4.26779175f, 2.68169117f, -7.18292999f);
            var actual6   = par1.vectorToWorldSpace(par2.p);

            Assert.AreEqual(expected6, actual6, "vectorToWorldSpace did not return expected results.");
        }