projectCircle static method
Implementation
static ({double min, double max}) projectCircle(
Vector2 center,
double radius,
Vector2 axis,
) {
final direction = axis.normalized();
final directionAndRadius = direction * radius;
final p1 = center + directionAndRadius;
final p2 = center - directionAndRadius;
var min = p1.dot(axis);
var max = p2.dot(axis);
if (min > max) {
// swap the min and max values.
final t = min;
min = max;
max = t;
}
return (min: min, max: max);
}