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 vx = direction.x >= 0 ? _right : _left;
final vy = direction.y >= 0 ? _bottom : _top;
return Vector2(vx, vy);
}