Torus
The Torus is a donut-shaped 3D primitive with configurable major radius, tube radius, and segment counts for both the ring and cross-section. Like all 3D shapes, it supports positioning, rotation, and automatic flat shading.
NOTE
For the full API, see the 3D API Reference.
Demo
Usage
ts
import {
createTorus,
} from '@ripl/3d';
const torus = createTorus({
radius: 2,
tube: 0.5,
radialSegments: 12,
tubularSegments: 24,
fill: '#8844cc',
});Properties
radius— Distance from center of torus to center of tubetube— Radius of the tuberadialSegments— Number of segments around the tube cross-section (default12)tubularSegments— Number of segments around the torus ring (default24)x/y/z— Position in world space (default0)rotationX/rotationY/rotationZ— Rotation around each axis in radians (default0)