/// <summary> /// Will add a point after the last point added /// </summary> public void addPoint(PolygonPoint p) { p.setPrevious(_last); p.setNext(_last.getNext()); _last.setNext(p); _points.Add(p); }
/// <summary> /// Will insert a point in the polygon after given point /// </summary> public void insertPointAfter(PolygonPoint a, PolygonPoint newPoint) { // Validate that int index = _points.IndexOf(a); if (index != -1) { newPoint.setNext(a.getNext()); newPoint.setPrevious(a); a.getNext().setPrevious(newPoint); a.setNext(newPoint); _points.Insert(index + 1, newPoint); } else { throw new Exception("Tried to insert a point into a Polygon after a point not belonging to the Polygon"); } }