Ejemplo n.º 1
0
        public void When_FindingClosestPointOnLineToPointOutsideSpan_Expect_EndPoints()
        {
            Vect3 lineStartPoint = new Vect3(0, 0, 0);
            Vect3 lineEndPoint   = new Vect3(10, 0, 0);

            Vect3 point1 = new Vect3(-15, 1, 0);
            Vect3 point2 = new Vect3(15, 500, 0);

            Vect3 closestLinePoint1 = Vect3.FindClosestLinePoint(lineStartPoint, lineEndPoint, point1);
            Vect3 closestLinePoint2 = Vect3.FindClosestLinePoint(lineStartPoint, lineEndPoint, point2);

            Assert.AreEqual(new Vect3(0, 0, 0), closestLinePoint1);
            Assert.AreEqual(new Vect3(10, 0, 0), closestLinePoint2);
        }
Ejemplo n.º 2
0
        public void When_FindingClosestPointOnLineToPointInSpan_Expect_ShorterThanEndPointLines()
        {
            Vect3 lineStartPoint = new Vect3(0, 0, 0);
            Vect3 lineEndPoint   = new Vect3(10, 0, 0);

            Vect3 point1 = new Vect3(5, 1, 0);
            Vect3 point2 = new Vect3(9, 500, 0);

            Vect3 closestLinePoint1 = Vect3.FindClosestLinePoint(lineStartPoint, lineEndPoint, point1);
            Vect3 closestLinePoint2 = Vect3.FindClosestLinePoint(lineStartPoint, lineEndPoint, point2);

            Assert.AreEqual(new Vect3(5, 0, 0), closestLinePoint1);
            Assert.AreEqual(new Vect3(9, 0, 0), closestLinePoint2);
        }