A sphere defined by a center and radius.
center — center of the sphere. Default is a Vector3 at (0, 0, 0)
.
radius — radius of the sphere. Default is -1
.
Creates a new Sphere.
A Vector3 defining the center of the sphere. Default is (0, 0, 0)
.
The radius of the sphere. Default is -1
.
matrix — the Matrix4 to apply.
Transforms this sphere with the provided Matrix4.
point — Vector3 the point to clamp.
target — the result will be copied into this Vector3.
Clamps a point within the sphere. If the point is outside the sphere, it will clamp it to the closest point on the edge of the sphere. Points already inside the sphere will not be affected.
Returns a new sphere with the same center and radius as this one.
point — the Vector3 to be checked.
Checks to see if the sphere contains the provided point inclusive of the surface of the sphere.
Copies the values of the passed sphere's center and radius properties to this sphere.
Returns the closest distance from the boundary of the sphere to the point. If the sphere contains the point, the distance will be negative.
point — Vector3 that should be included in the sphere.
Expands the boundaries of this sphere to include point.
Checks to see if the sphere is empty (the radius set to a negative number).
Spheres with a radius of 0 contain only their center point and are not considered to be empty.
Makes the sphere empty by setting center to (0, 0, 0)
and radius to -1
.
Checks to see if the two spheres' centers and radii are equal.
target — the result will be copied into this Box3.
Returns aMinimum Bounding Box for the sphere.
box — Box3 to check for intersection against.
Determines whether or not this sphere intersects a given box.
plane — Plane to check for intersection against.
Determines whether or not this sphere intersects a given plane.
sphere — Sphere to check for intersection against.
Checks to see if two spheres intersect.
center — center of the sphere.
radius — radius of the sphere.
Sets the center and radius properties of this sphere.
Please note that this method only copies the values from the given center.
points — an Array of Vector3 positions.
optionalCenter — Optional Vector3 position for the sphere's center.
Computes the minimum bounding sphere for an array of 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.
Translate the sphere's center by the provided offset Vector3.
sphere — Bounding sphere that will be unioned with this sphere.
Expands this sphere to enclose both the original sphere and the given sphere.
For more info on how to obtain the source code of this module see this page.