Torus
The Torus is a ring-shaped 3D primitive: radius is the distance out to the tube's centre, tube its thickness, and radialSegments (default 12) and tubularSegments (default 24) its resolution.
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)scaleX/scaleY/scaleZ: scale along each axis (default1), orscalefor all threematerial: how the surface responds to light — see Materials
Type Guard
ts
import {
elementIsTorus,
} from '@ripl/3d';
if (elementIsTorus(element)) {
console.log(element.tube);
}