Esempio n. 1
0
        public void TestDistanceFromPoint()
        {
            // Define variables and constants


            // Set up context


            // Execute


            // Assert outcome
            Assert.AreEqual(5f, testCuboidA.DistanceFrom(new Vector3(4f, 3f, 10f)));
            Assert.AreEqual(0f, testCuboidB.DistanceFrom(new Vector3(-20f, -25f, -15f)));
            Assert.AreEqual((float)Math.Sqrt(3f), testCuboidC.DistanceFrom(new Vector3(3f, 4f, 5f)));
            Assert.AreEqual((float)Math.Sqrt(300f), testCuboidD.DistanceFrom(new Vector3(-40f, 40f, 10f)));
            Assert.AreEqual((float)Math.Sqrt(9f + 16f), testCuboidE.DistanceFrom(new Vector3(15f, -7f, 1.5f)));
        }
Esempio n. 2
0
        public void TestDistanceFromCuboid()
        {
            // Define variables and constants


            // Set up context


            // Execute


            // Assert outcome
            Assert.AreEqual(10f, testCuboidA.DistanceFrom(new Plane(Vector3.RIGHT, 10f)));
            Assert.AreEqual((float)Math.Sqrt(200f), testCuboidB.DistanceFrom(new Plane(Vector3.LEFT + Vector3.DOWN, 0f)));
            Assert.AreEqual(105f, testCuboidC.DistanceFrom(new Plane(Vector3.DOWN, -100f)));
            Assert.AreEqual(0f, testCuboidD.DistanceFrom(new Plane(Vector3.FORWARD, -20f)));
            Assert.AreEqual(0f, testCuboidE.DistanceFrom(new Plane(Vector3.LEFT, 12f)));
        }