Example #1
0
        public void TestPushingOfInSpaceInZDirection()
        {
            // polygon which we will be moving
            Polygon3D t1 = new Polygon3D(new List <Point3D> {
                t1_1, t1_2, t1_3
            }, "t1");
            // create static polygon, we will be testing whether there is any pushing or not for this polygone
            Vector3D  shift = (-2 * uX) + (-1 * uY) + (+2 * uZ);
            Polygon3D t2    = new Polygon3D(new List <Point3D> {
                t1_1 + shift, t1_2 + shift, t1_3 + shift
            }, "t2");

            // we will be pushing one unit up (in Z coordinate) each time and testing the pusing of
            Vector3D pushingV = (0 * uX) + (0 * uY) + (1 * uZ);

            Vector3D expectedV = new Vector3D(0, 0, 0);
            Vector3D resultV   = t1.PushingOf(t2, pushingV);

            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance * 100)); // XJB - pushes a bit more by design => increase tolerance

            pushingV += uZ;
            resultV   = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance * 100)); // XJB - pushes a bit more by design => increase tolerance

            pushingV  += uZ;
            expectedV += uZ;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance * 100)); // XJB - pushes a bit more by design => increase tolerance

            pushingV  += uZ;
            expectedV += uZ;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance * 100)); // XJB - pushes a bit more by design => increase tolerance
        }
Example #2
0
        public void TestPushingOfInSpaceInYDirection()
        {
            // polygon which we will be moving
            Polygon3D t1 = new Polygon3D(new List <Point3D> {
                t1_1, t1_2, t1_3
            }, "t1");
            // create static polygon, we will be testing whether there is any pushing or not for this polygone
            Polygon3D t2 = new Polygon3D(new List <Point3D> {
                new Point3D(1, -1, -1), new Point3D(1, -1, -4), new Point3D(4, -4, -4)
            }, "t2");

            // we will be pushing one unit up (in Z coordinate) each time and testing the pusing of
            Vector3D pushingV = (0 * uX) + (0 * uY) + (-1 * uZ);

            Vector3D expectedV = new Vector3D(0, 0, 0);
            Vector3D resultV   = t1.PushingOf(t2, pushingV);

            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  -= uZ;
            expectedV -= uZ;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  -= uZ;
            expectedV -= uZ;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  -= uZ;
            expectedV -= uZ;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  -= uZ;
            expectedV -= uZ;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));
        }
Example #3
0
        public void TestPushingOfInPlaneInYDirection()
        {
            // polygon which we will be moving
            Polygon3D t1 = new Polygon3D(new List <Point3D> {
                t1_1, t1_2, t1_3
            }, "t1");
            // create static polygon on the same plane, we will be testing whether there is any pushing or not for this polygone
            Vector3D  shift = (-2 * uX) + (3 * uY);
            Polygon3D t2    = new Polygon3D(new List <Point3D> {
                t1_1 + shift, t1_2 + shift, t1_3 + shift
            }, "t2");

            // we will be pushing one unit up (in Y coordinate) each time and testing the pusing of
            Vector3D pushingV = (0 * uX) + (1 * uY) + (0 * uZ);

            Vector3D expectedV = new Vector3D(0, 0, 0);
            Vector3D resultV   = t1.PushingOf(t2, pushingV);

            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV += uY;
            resultV   = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  += uY;
            expectedV += uY;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  += uY;
            expectedV += uY;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  += uY;
            expectedV += uY;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  += uY;
            expectedV += uY;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));

            pushingV  += uY;
            expectedV += uY;
            resultV    = t1.PushingOf(t2, pushingV);
            Assert.IsTrue(expectedV.Equals(resultV, MSystem.Tolerance));
        }