/// <summary> /// Get the line segments consisting of all the edges of this polygon. /// </summary> /// <returns></returns> private List <LineSegment2> GetEdges() { List <LineSegment2> retlist = new List <LineSegment2>(); if ((null == Points) || (2 > Points.Count)) { return(retlist); } Point2 firstpoint = Points[0]; Point2 lastpoint = Points[Points.Count - 1]; Point2 curpoint = firstpoint; for (int i = 1; i < Points.Count; i++) { Point2 nextpoint = Points[i]; LineSegment2 seg = new LineSegment2(curpoint, nextpoint); retlist.Add(seg); curpoint = nextpoint; } retlist.Add(new LineSegment2(lastpoint, firstpoint)); return(retlist); }
public bool IntersectsWith(LineSegment2 otherSegment) { return(Intersection(otherSegment) != null); }
public static Point2 Intersection(LineSegment2 segment1, LineSegment2 segment2) { return(Intersection(segment1.PointA.X, segment1.PointA.Y, segment1.PointB.X, segment1.PointB.Y, segment2.PointA.X, segment2.PointA.Y, segment2.PointB.X, segment2.PointB.Y)); }
public Point2 Intersection(LineSegment2 otherSegment) { return(Intersection(this, otherSegment)); }