Skip to content

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

PropertyTypeDefaultDescription
radiusnumberDistance from center of torus to center of tube
tubenumberRadius of the tube
radialSegmentsnumber12Number of segments around the tube cross-section
tubularSegmentsnumber24Number of segments around the torus ring
xnumber0X position
ynumber0Y position
znumber0Z position
rotationXnumber0Rotation around X axis (radians)
rotationYnumber0Rotation around Y axis (radians)
rotationZnumber0Rotation around Z axis (radians)

Demo