Sphere
new Sphere(centre?: Vector3, radius?: number)THREE equivalent: THREE.Sphere
Bounding sphere used for frustum culling and intersection tests.
Differs from THREE.js
Uses British spelling: centre instead of center.
Properties
Section titled “Properties”| Name | Type | Description |
|---|---|---|
centre |
Vector3 |
Sphere center. |
radius |
number |
Sphere radius. Default -1 (empty). |
Methods
Section titled “Methods”| Method | Description |
|---|---|
containsPoint(point: Vector3): boolean |
Returns true if the point is inside the sphere. |
distanceToPoint(point: Vector3): number |
Returns the distance from the point to the sphere surface (negative if inside). |
intersectsSphere(sphere: Sphere): boolean |
Returns true if the spheres overlap. |
translate(offset: Vector3): this |
Moves the sphere by the given offset. |
setFromPoints(points: Vector3[], optionalCenter?: Vector3): this |
Computes the bounding sphere from an array of points. Uses the provided center or computes the centroid. |
expandByPoint(point: Vector3): this |
Expands the radius to include the point if it lies outside the sphere. |
clone(): Sphere |
Returns a new Sphere with the same centre and radius. |