[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

[property:Vector3 center]

[property:Float radius]

Methods

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

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

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

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

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

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.

[method:Sphere translate]( [page:Vector3 offset] ) [page:Sphere this]

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

[method:Sphere clone]()

Provides a new copy of the sphere.

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

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

[method:Sphere 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.

[method:Float distanceToPoint]( [page:Vector3 point] )

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.

[method:Box getBoundingBox]( [page:Box optionalTarget] )

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

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

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

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

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

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

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

[method:Boolean empty]()

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]