clampPoint method
Ensures the given point is inside this bounding sphere and stores the result in the given vector.
Implementation
Vector3 clampPoint( Vector3 point, Vector3 result ) {
result.copy( point );
final squaredDistance = center.squaredDistanceTo( point );
if ( squaredDistance > ( radius * radius ) ) {
result.sub( center ).normalize();
result.multiplyScalar( radius ).add(center );
}
return result;
}