Creates a new BoundingSphere instance.
Optionalcenter: Vec3 = ...
The world space coordinate marking the center of the sphere. The constructor takes a reference of this parameter.
Optionalradius: number = 0.5
The radius of the bounding sphere. Defaults to 0.5.
ReadonlycenterCenter of sphere.
The radius of the bounding sphere.
Test if a point is inside the sphere.
Point to test.
True if the point is inside the sphere and false otherwise.
Test if a Bounding Sphere is overlapping, enveloping, or inside this Bounding Sphere.
Bounding Sphere to test.
True if the Bounding Sphere is overlapping, enveloping, or inside this Bounding Sphere and false otherwise.
A bounding sphere is a volume for facilitating fast intersection testing.
A sphere is a center and a radius. It is the cheapest bounding volume to test, so it suits broad-phase checks made before a finer test. containsPoint, intersectsBoundingSphere and intersectsRay return a boolean and allocate nothing. Unlike BoundingBox, the constructor keeps a reference to the center vector it is given rather than copying it, so the sphere follows any later changes to that vector.
Example