Cone
The Cone is a 3D primitive with a pointed apex over a circular base. segments (default 16) sets how many triangles wrap that base, and each face is flat shaded from its own normal.
NOTE
For the full API, see the 3D API Reference.
Demo
Usage
ts
import {
createCone,
} from '@ripl/3d';
const cone = createCone({
radius: 1,
height: 2,
segments: 16,
fill: '#cc4444',
});Properties
radius: base radiusheight: height from base to apexsegments: number of radial segments (default16)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 {
elementIsCone,
} from '@ripl/3d';
if (elementIsCone(element)) {
console.log(element.height);
}