[name]

A geometric sphere defined by a center position and radius.

Constructor

[name]([page:Vector3 center], [page:Float radius])

center -- [page:Vector3]
radius -- [page:Float]

Properties

.[page:Vector3 center]

.[page:Float radius]

Methods

.set([page:Vector3 center], [page:Float radius]) [page:this:Sphere]

center -- [page:Vector3]
radius -- [page:Float]
Sets the center and radius.

.applyMatrix4([page:Matrix4 matrix]) [page:Sphere this]

matrix -- [page:Matrix4]
Transforms this sphere with the provided [page:Matrix4].

.clampPoint([page:Vector3 point], [page:Vector3 optionalTarget]) [page:Vector3]

point -- [page:Vector3] The point to clamp
optionalTarget -- [page: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([page:Vector3 offset]) [page:Sphere this]

offset -- [page:Vector3]
Translate the sphere's center by the provided offset vector.

.clone() [page:Sphere]

Provides a new copy of the sphere.

.equals([page:Sphere sphere]) [page:Boolean]

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

.setFromPoints([page:Array points], [page:Vector3 optionalCenter]) [page:Sphere this]

points -- [page:Array] of [page:Vector3] positions.
optionalCenter -- Optional [page: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([page:Vector3 point]) [page:Float]

point -- [page: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([page:Box optionalTarget]) [page:Box]

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

.containsPoint([page:Vector3 point]) [page:Boolean]

point -- [page:Vector3]
Checks to see if the sphere contains the provided point inclusive of the edge of the sphere.

.copy([page:Sphere sphere]) [page:Sphere]

sphere -- [page:Sphere] to copy
Copies the values of the passed sphere to this sphere.

.intersectsSphere([page:Sphere sphere]) [page:Boolean]

sphere -- [page:Sphere]
Checks to see if two spheres intersect.

.empty() [page:Boolean]

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

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]