Torus
A 3D torus (donut shape) with configurable major radius, tube radius, and segment counts.
Usage
ts
import { createTorus } from '@ripl/3d';
const torus = createTorus({
radius: 2,
tube: 0.5,
radialSegments: 12,
tubularSegments: 24,
fillStyle: '#8844cc',
});Properties
| Property | Type | Default | Description |
|---|---|---|---|
radius | number | — | Distance from center of torus to center of tube |
tube | number | — | Radius of the tube |
radialSegments | number | 12 | Number of segments around the tube cross-section |
tubularSegments | number | 24 | Number of segments around the torus ring |
x | number | 0 | X position |
y | number | 0 | Y position |
z | number | 0 | Z position |
rotationX | number | 0 | Rotation around X axis (radians) |
rotationY | number | 0 | Rotation around Y axis (radians) |
rotationZ | number | 0 | Rotation around Z axis (radians) |