Sphere
An analytical 3D sphere defined by a center and radius. This class is mainly used as a Bounding Sphere for 3D objects.
The sphere is mutable and not thread-safe; confine an instance (and any object graph holding it) to a single thread, exactly as in three.js.
The constructor stores the given center by reference (it does not copy it). Sharing that vector with another object means later mutations are visible through every alias; use set or clone for independent storage.
A sphere with a negative radius is considered empty (see isEmpty); a radius of 0 contains only the center point and is not empty.
Constructors
Properties
Functions
Transforms this sphere with the given 4x4 transformation matrix matrix.
Returns true if this sphere contains the given point inclusive of the surface of the sphere.
Returns the closest distance from the boundary of the sphere to the given point. If the sphere contains the point, the distance will be negative.
Expands the boundaries of this sphere to include the given point.
Sets this sphere from json laid out as [centerX, centerY, centerZ, radius].
Writes a bounding box that encloses this sphere into target.
Returns true if this sphere intersects with the given box.
Returns true if this sphere intersects with the given plane.
Returns true if this sphere intersects with the given one sphere.
Computes the minimum bounding sphere for a list of points. If the optional optionalCenter is given, it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing the points is calculated.
Writes this sphere as [centerX, centerY, centerZ, radius].