centroid property

  1. @override
Point<double> get centroid
override

The mathematical center of mass of the shape.

Implementation

@override
Point<double> get centroid {
  return Point(
    x: (p1.x + p2.x) / 2.0,
    y: (p1.y + p2.y) / 2.0
  );
}