/// \param center Specifies the center of the sphere. /// \param radius Specifies the radius of the sphere. /// \return ttrue iff the sphere and AABB intersect. bool AABB3::intersectsSphere(const Vector3 ¢er, float radius) const { // Find the closest point on box to the point Vector3 closestPoint = closestPointTo(center); // Check if it's within range return Vector3::distanceSquared(center, closestPoint) < radius*radius; }
BOOL CBox::IntersectSphere(vector3d&vcenter , float radius) { vector3d closestpoint = closestPointTo(vcenter); return vcenter.dist_sqr(closestpoint) < radius * radius; }
//========================================================= double SGLCurve2d::distanceTo(const SGLCurve2d& curve, const SGLTol& tol) const { SGLPoint2d ptOther, ptCl = closestPointTo(curve, ptOther, tol); return ptCl.distance2To(ptOther); }
//========================================================= double SGLCurve2d::distanceTo(const SGLPoint2d& pnt, const SGLTol& tol) const { SGLPoint2d ptCl = closestPointTo(pnt, tol); return ptCl.distance2To(pnt); }