centre x
centre y
centre z
sphere radius
Centre coordinates of the sphere (Y-down, +Z forward — Camera3d convention).
Sphere radius. Negative values are treated like their absolute value in Sphere.overlaps / Sphere.contains.
Reset the sphere to a zero-radius point at the origin.
Deep copy of this sphere. The clone shares NOTHING with the
original — independent pos Vector3d, independent AABB cache.
Pulls from spherePool so back-to-back clones are
allocation-free.
Test whether a point lies inside the sphere (boundary inclusive).
Squared-distance test — no sqrt on the hot path. Matches the
boundary convention of AABB3d.contains.
point x
point y
point z
Smallest AABB3d containing this sphere. Cached — repeat
calls without a setShape between return the same instance and
the same values.
Test whether this sphere overlaps another. Boundary inclusive (touching surfaces count as overlap), matching AABB3d.overlaps.
the other sphere
Test whether this sphere overlaps an axis-aligned box. Delegates to AABB3d.overlapsSphere so the two shapes agree on boundary semantics.
the box
Re-position and resize the sphere in one shot. Mirrors Ellipse.setShape.
centre x
centre y
centre z
sphere radius
this sphere for chaining
A 3D sphere —
{ centre, radius }. Sibling of Ellipse in the geometry surface; used by Octree /adapter.querySphereas the canonical 3D region-query shape, and by user code for any sphere-vs-sphere / sphere-vs-AABB collision check under Camera3d.Not currently part of the BodyShape union —
Bodyis 2D- only in melonJS today; Sphere is a math/geometry primitive that would slot in once a 3D physics adapter ships.Example