ReadonlycenterThe center of the sphere
The radius of the sphere; negative values mark the sphere as empty
ReadonlytypeNames the shape without an instanceof check, like the type on pixi's 2D shapes
Transforms this sphere by an affine matrix
The radius scales by the matrix's largest axis scale, so the sphere still bounds the shape under rotation and per-axis scale. Under shear, as when a non-uniformly scaled parent holds a rotated child, the radius can come out too small; for one that always fits, multiply the original radius by the square root of Matrix4#getMaxSingularValueSq yourself. An empty sphere stays empty.
matrix must be affine (bottom row [0, 0, 0, 1]), as a Container3D#worldTransform
always is and a projection matrix isn't.
The result sphere for chaining
Returns true when point is inside this sphere (boundary is inclusive)
The point to test
Whether the point is inside this sphere
Copies sphere into this sphere
The sphere to copy from
This sphere for chaining
Returns the signed distance from point to the surface of this sphere (negative when inside)
The point to measure from
The signed distance to the sphere surface
Returns true when center and radius match sphere exactly (no epsilon tolerance)
The sphere to compare with
Whether the center and radius match
Returns true when this sphere and box overlap; an empty sphere never does
The box to test
Whether the sphere and box overlap
Returns true when plane passes through this sphere or touches it; never for an empty sphere
The plane to test
Whether the plane passes through or touches the sphere
Returns true when ray hits this sphere; same as Ray#intersectsSphere
The ray to test
Whether the ray hits this sphere
Returns true when this sphere and sphere overlap; an empty sphere never does
The sphere to test
Whether the spheres overlap
Sets the center and radius of this sphere, copying the center
The center of the sphere
The radius of the sphere
This sphere for chaining
Sets this sphere to the smallest sphere around box's corners; an empty box gives an empty sphere
The box to bound
This sphere for chaining
Advanced
Returns a string representation of this sphere
A string in the form [@pixi/3d/math:Sphere center=(0, 0, 0) radius=1]
A sphere from
centerandradius, mostly used as a bounding volumeThe cheapest volume to test, and unlike a Box it doesn't grow when rotated. Mesh3D#boundingSphere gives a mesh's bounding sphere in world space.
Example
See
Ray#intersectSphere For the point where a ray hits the sphere