圆形与球体
表达方式
相交测试
bool intersects(const Circle& a, const Circle& b)
{
const float min_distance = a.radius + b.radius;
return (a.center - b.center).norm_sq() <= min_distance * min_distance;
}
bool intersects(const Sphere& a, const Sphere& b)
{
const float min_distance = a.radius + b.radius;
return (a.center - b.center).norm_sq() <= min_distance * min_distance;
}