getPolygonOuterCircleCentroid method Null safety

Point<num> getPolygonOuterCircleCentroid(
  1. List<Point<num>> list
)

Get the centroid of Outer circle

this centroid is calculated from the distance to the vertices or the polygon.

Implementation

static Point getPolygonOuterCircleCentroid(List<Point> list) {
  assert(list.length >= 3);

  final n = list.length;

  var center = list.reduce((c, n) => Point(c.x + n.x, c.y + n.y));

  return Point(center.x / n, center.y / n);
}