containsPoint method

  1. @override
bool containsPoint(
  1. Vector2 point
)
override

Returns true if the given point is inside the shape or on the boundary.

Implementation

@override
bool containsPoint(Vector2 point) {
  final x0 = point.x;
  final y0 = point.y;
  if (x0 < _left || x0 > _right || y0 < _top || y0 > _bottom) {
    return false;
  }
  final fx = _radius - min(x0 - _left, min(_right - x0, _radius));
  final fy = _radius - min(y0 - _top, min(_bottom - y0, _radius));
  return fx * fx + fy * fy <= _radius * _radius;
}