support method
Finds the intersection of this shape with another one, if it exists.
Returns a point on the boundary that is furthest in the given direction
.
In other words, this returns such a point p
within in the shape for
which the dot-product p·direction
is maximal. If multiple such points
exist, then any one of them can be returned.
The direction
vector may have length not equal to 1.
This method is only used for convex shapes.
Implementation
@override
Vector2 support(Vector2 direction) {
final result = direction.normalized()..length = _radius;
result.x += direction.x >= 0 ? _right - _radius : _left + _radius;
result.y += direction.y >= 0 ? _bottom - _radius : _top + _radius;
return result;
}