public void IsOnLineSegmentTest() { // test 1 - slope - point beetween Point p1 = new Point(140, 290); Point p2 = new Point(92, 480); Point p = new Point(116, 380); bool result = RoutePointsCollection_Accessor.IsPointOnLineSegment(p1.X, p1.Y, p2.X, p2.Y, p.X, p.Y); Assert.IsTrue(result); }
public void IsOnLineSegmentVerticalLineTest() { // test 1 - vertical line - point beetween Point p1 = new Point(5, 5); Point p2 = new Point(5, 10); Point p = new Point(5, 7); bool result = RoutePointsCollection_Accessor.IsPointOnLineSegment(p1.X, p1.Y, p2.X, p2.Y, p.X, p.Y, tolerance); Assert.IsTrue(result); // test 2 - vertical line - point not beetween p1 = new Point(5, 5); p2 = new Point(5, 10); p = new Point(6, 7); result = RoutePointsCollection_Accessor.IsPointOnLineSegment(p1.X, p1.Y, p2.X, p2.Y, p.X, p.Y, tolerance); Assert.IsFalse(result); //test 3 - vertical line within tolerance - point beetween p1 = new Point(5, 5); p2 = new Point(5 + tolerance, 10); p = new Point(5, 7); result = RoutePointsCollection_Accessor.IsPointOnLineSegment(p1.X, p1.Y, p2.X, p2.Y, p.X, p.Y, tolerance); Assert.IsTrue(result); }