Sphere

A geometric sphere defined by a center position and radius.

Constructor

Sphere( center, radius )

center -- Vector3
radius -- Float

Properties

.center

.radius

Methods

.set ( center, radius ) this

center -- Vector3
radius -- Float
Sets the center and radius.

.applyMatrix4 ( matrix ) this

matrix -- Matrix4
Transforms this sphere with the provided Matrix4.

.clampPoint ( point, optionalTarget )

point -- Vector3 The point to clamp
optionalTarget -- Vector3 The optional target point to return
Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the closets point on the edge of the sphere.

.translate ( offset ) this

offset -- Vector3
Translate the sphere's center by the provided offset vector.

.clone ()

Provides a new copy of the sphere.

.equals ( sphere )

sphere -- Sphere
Checks to see if the two spheres' centers and radii are equal.

.setFromPoints ( points, optionalCenter ) this

points -- Array of Vector3 positions.
optionalCenter -- Optional Vector3 position for the sphere's center.
Computes the minimum bounding sphere for points. If optionalCenter is given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing points is calculated.

.distanceToPoint ( point )

point -- Vector3
Returns the closest distance from the boundary of the sphere to the point. If the sphere contains the point, the distance will be negative.

.getBoundingBox ( optionalTarget )

optionalTarget -- Box
Returns a bounding box for the sphere, optionally setting a provided box target.

.containsPoint ( point )

point -- Vector3
Checks to see if the sphere contains the provided point inclusive of the edge of the sphere.

.copy ( sphere )

sphere -- Sphere to copy
Copies the values of the passed sphere to this sphere.

.intersectsSphere ( sphere )

sphere -- Sphere
Checks to see if two spheres intersect.

.empty ()

Checks to see if the sphere is empty (the radius set to 0).

Source

src/math/Sphere.js
Edit