isClosedPolygon static method

bool isClosedPolygon(
  1. List<Point<num>> poly
)

Returns true if the provided list of points is a closed polygon (i.e., the first and last points are the same), and false if it is not

poly polyline or polygon

return true if the provided list of points is a closed polygon (i.e., the first and last points are the same), and false if it is not

Implementation

static bool isClosedPolygon(List<Point> poly) {
  if (poly.isEmpty) return false;
  Point firstPoint = poly[0];
  Point lastPoint = poly[poly.length - 1];
  return firstPoint == lastPoint;
}