normalized method

RoundedPolygon normalized()

Implementation

RoundedPolygon normalized() {
  final bounds = calculateBounds();
  final width = bounds[2] - bounds[0];
  final height = bounds[3] - bounds[1];
  final side = math.max(width, height);

  final offsetX = (side - width) / 2 - bounds[0]; /* left */
  final offsetY = (side - height) / 2 - bounds[1]; /* top */

  return transformed((x, y) => ((x + offsetX) / side, (y + offsetY) / side));
}