/// <summary> /// Sets the index-th edge of this polygon. /// </summary> public static IImmutablePolygon <V2d> SetEdge(this IImmutablePolygon <V2d> self, int index, Line2d edge) { index = self.RepairIndex(index); var i0 = index++; var i1 = index < self.Count ? index : 0; return(self.SetPoint(i0, edge.P0).SetPoint(i1, edge.P1)); }
/// <summary> /// Gets the index-th edge of this polygon. /// </summary> public static Line2d GetEdge(this IImmutablePolygon <V2d> self, int index) { index = self.RepairIndex(index); var p0 = self.Points[index++]; var p1 = self.Points[index < self.Count ? index : 0]; return(new Line2d(p0, p1)); }