public static LineSegment2DF[] PolyLine(PointF[] points, bool closed)
{
LineSegment2DF[] res;
int length = points.Length;
if (closed)
{
res = new LineSegment2DF[length];
PointF lastPoint = points[length - 1];
for (int i = 0; i < res.Length; i++)
{
res[i] = new LineSegment2DF(lastPoint, points[i]);
lastPoint = points[i];
}
}
else
{
res = new LineSegment2DF[length - 1];
PointF lastPoint = points[0];
for (int i = 1; i < res.Length; i++)
{
res[i] = new LineSegment2DF(lastPoint, points[i]);
lastPoint = points[i];
}
}
return res;
}