scale method

  1. @override
Polygon scale(
  1. num factor
)
override

Scales the shape uniformly by the given factor originating from centroid.

Implementation

@override
Polygon scale(num factor) {
  final c = centroid;
  return Polygon(vertices.map((p) => Point(
    x: c.x + (p.x - c.x) * factor,
    y: c.y + (p.y - c.y) * factor
  )).toList(growable: false));
}