boundingBox property

Rectangle get boundingBox

Approximate bounding box

Implementation

Rectangle get boundingBox {
  double minX = start.x, maxX = start.x;
  double minY = start.y, maxY = start.y;

  // Sample points + control points for conservative bound
  for (final p in [start, control1, control2, end]) {
    minX = min(minX, p.x);
    maxX = max(maxX, p.x);
    minY = min(minY, p.y);
    maxY = max(maxY, p.y);
  }

  return Rectangle(x: minX, y: minY, width: maxX - minX, height: maxY - minY);
}