← Standard library

Sphere

struct Sphere
import Sphere from Wax;

A 3D ball described by a center and radius. Supply a finite, nonnegative radius; construction does not validate it. Containment and intersection include the boundary.

Geometry3D.wax:124

Members

centerfield

public float3 center

The center position.

Geometry3D.wax:128

radiusfield

public float radius

The radius, expected to be nonnegative.

Geometry3D.wax:132

constructorconstructor

public constructor (float3 center, float radius)

Stores the center and radius without validation.

Geometry3D.wax:137

volumegetter

public get volume() : float

Returns (4/3)*pi times radius cubed.

Geometry3D.wax:145

surfaceAreagetter

public get surfaceArea() : float

Returns 4*pi times radius squared.

Geometry3D.wax:152

boundingBoxgetter

public get boundingBox() : AABB

Returns the tight axis-aligned bounding box.

Geometry3D.wax:159

Containsmethod

public fn Contains(float3 point) : bool

Tests whether a point lies inside or on the boundary.

Geometry3D.wax:169

Intersectsmethod

public fn Intersects(Sphere other) : bool

Tests whether two balls overlap or touch.

Geometry3D.wax:179

IntersectsAABBmethod

public fn IntersectsAABB(AABB box) : bool

Tests intersection with an axis-aligned box, including tangency. Supply ordered box bounds.

Geometry3D.wax:190

ToStringmethod

public fn ToString() : string

Provided by the compiler.

ToStringBuffermethod

public fn ToStringBuffer(StringBuilder builder) : int32

Provided by the compiler.