public void TestNonIntersection1() { LineSegment ls1 = new LineSegment(new Point(0, 0), new Point(100, 100)); LineSegment ls2 = new LineSegment(new Point(100, 0), new Point(100, 50)); Assert.IsFalse(ls1.Intersects(ls2)); }
private void SortCounterPoints(List<CardinalLinkPoint> list) { for (int i = 0; i < list.Count; i++) { for (int j = 0; j < list.Count; j++) { if (i != j) { LinkPoint counterPoint1 = list[i].GetCounterPoint(); LinkPoint point1 = list[i]; LinkPoint counterPoint2 = list[j].GetCounterPoint(); LinkPoint point2 = list[j]; LineSegment lineSegment1 = new LineSegment(point1.Location, counterPoint1.Location); LineSegment lineSegment2 = new LineSegment(point2.Location, counterPoint2.Location); if (lineSegment1.Intersects(lineSegment2)) { int t = 0; t = list[i].X; list[i].X = list[j].X; list[j].X = t; t = list[i].Y; list[i].Y = list[j].Y; list[j].Y = t; } } } } }
public void TesIntersection2() { LineSegment ls1 = new LineSegment(new Point(20, 10), new Point(30, 60)); LineSegment ls2 = new LineSegment(new Point(10, 10), new Point(100, 30)); Assert.IsTrue(ls1.Intersects(ls2)); }