cellCentroid method
Returns the centroid of cell i.
Implementation
Point? cellCentroid(int i) {
final polygon = cellPolygon(i);
if (polygon == null || polygon.isEmpty) return null;
double cx = 0, cy = 0;
for (final p in polygon) {
cx += p.x;
cy += p.y;
}
return Point(cx / polygon.length, cy / polygon.length);
}