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