CapsuleShape
The convex hull of two spheres centered at [0, -height / 2, 0] and [0, height / 2, 0].
Usageโ
import {CapsuleShape} from '@math.gl/geometry/culling';
const shape = new CapsuleShape({height: 2, radiusBottom: 0.5, radiusTop: 0.5});
Constructorโ
new CapsuleShape(options?)โ
| Option | Default | Description |
|---|---|---|
height | 1 | Distance between the sphere centers; finite and positive. |
radiusBottom | 0.5 | Lower sphere radius; finite and nonnegative. |
radiusTop | 0.5 | Upper sphere radius; finite and nonnegative. |
matrix | identity | Optional invertible affine local-to-world matrix. |
The height excludes the rounded caps. At least one radius must be positive. Unequal radii produce a tapered capsule.
Queriesโ
Implements the Shape interface, including containment, distance, ray and plane intersection, transforms, cloning, and enclosing bounds.
Dimensions and defaults align with the glTF 2.1 draft shape specification.