Skip to content

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 radius
  • height: height from base to apex
  • segments: number of radial segments (default 16)
  • x / y / z: position in world space (default 0)
  • rotationX / rotationY / rotationZ: rotation around each axis in radians (default 0)
  • scaleX / scaleY / scaleZ: scale along each axis (default 1), or scale for all three
  • material: how the surface responds to light — see Materials

Type Guard

ts
import {
    elementIsCone,
} from '@ripl/3d';

if (elementIsCone(element)) {
    console.log(element.height);
}