Exemple #1
0
        /// <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));
        }
Exemple #2
0
 /// <summary>
 /// Returns new polygon with point transformed.
 /// </summary>
 public static IImmutablePolygon <V2d> TransformPoint(this IImmutablePolygon <V2d> self, int index, M33d trafo)
 => self.SetPoint(index, trafo.TransformPos(self.Points[index]));
Exemple #3
0
 /// <summary>
 /// Returns new polygon with point moved.
 /// </summary>
 public static IImmutablePolygon <V2d> MovePoint(this IImmutablePolygon <V2d> self, int index, V2d delta)
 => self.SetPoint(index, self.Points[index] + delta);