Skip to content
Projects

dmnsgn/primitive-geometry

View on GitHub

dmnsgn/primitive-geometry has 107 GitHub stars and 8 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-16 19:45 UTC. Last push 2026-10-26.

How these counts are measured

What you can do

  • 71 geometries: planes and grids, quadrilaterals and arcs, solids of revolution, prisms, platonic and stellated polyhedra, geodesic spheres - plus 21 outline paths and 10 polyhedra polygon variants.
  • Common API: options object in, complex out: a SimplicialComplex (triangles with normals and uvs), a PolygonalComplex (grids and *Polygons) or a PolylineComplex (*Path). Parameters are named the same everywhere (sx/sy/sz, nx/ny/nz, radius, segments, theta/phi).
  • Unit-sized defaults: every geometry fits in the origin-centered unit cube. Polyhedra and geodesic spheres share a 0.5 circumradius (tips for star polyhedra), like sphere, so they read at a common scale (the tetrahedron centers its bounding box rather than its centroid); cuboids and planes fill the cube.
  • TypedArray out: Float32Array for positions, normals and uvs, cells narrowed to Uint8Array|Uint16Array|Uint32Array by vertex count (or pinned with setTypedArrayType).

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Geometries for 3D rendering: planes, grids, solids, polyhedra and outline paths, with normals, UVs and cell indices (faces). Perfect if you want to supercharge your dependency folder... with 20KB of geometries.

Creative & Media

README.md

Original

primitive-geometry

npm version stability-stable npm minzipped size dependencies types Conventional Commits styled with prettier linted with eslint license

Geometries for 3D rendering: planes, grids, solids, polyhedra and outline paths, as triangle meshes with normals and UVs, or as polygon and polyline complexes. Perfect if you want to supercharge your dependency folder... with 20KB of geometries.

paypal coinbase twitter

primitive-geometry screenshot

Installation

npm install primitive-geometry

Features

  • 71 geometries: planes and grids, quadrilaterals and arcs, solids of revolution, prisms, platonic and stellated polyhedra, geodesic spheres - plus 21 outline paths and 10 polyhedra polygon variants.
  • Common API: options object in, complex out: a SimplicialComplex (triangles with normals and uvs), a PolygonalComplex (grids and *Polygons) or a PolylineComplex (*Path). Parameters are named the same everywhere (sx/sy/sz, nx/ny/nz, radius, segments, theta/phi).
  • Unit-sized defaults: every geometry fits in the origin-centered unit cube. Polyhedra and geodesic spheres share a 0.5 circumradius (tips for star polyhedra), like sphere, so they read at a common scale (the tetrahedron centers its bounding box rather than its centroid); cuboids and planes fill the cube.
  • TypedArray out: Float32Array for positions, normals and uvs, cells narrowed to Uint8Array|Uint16Array|Uint32Array by vertex count (or pinned with setTypedArrayType).
  • Welded, crack-free meshes: vertices shared between patches are bit-identical, not merely close. Every geometry is checked for cracks, non-manifold edges, degenerate cells, winding and uv continuity across 101 configurations.
  • Partial shapes: theta/phi sweeps with optional caps, hollow variants, and vDistribution to choose how rows spread along a revolution's meridian.
  • 17 UV mappings, swappable per compatible geometry: see the comparison images and the demo.
  • Zero dependency, tree-shakeable: ~1.7KB min+gzip for a single geometry, ~21KB for all of them.

Usage

See the example and its source.

import * as Primitives from "primitive-geometry";

const { mappings, utils } = Primitives;

const geometry = Primitives.quad({ scale: 1 });
console.log(geometry);
// {
//   positions: Float32Array [x, y, z, x, y, z,  ...],
//   normals: Float32Array [x, y, z, x, y, z, ...]
//   uvs: Float32Array [u, v, u, v, ...],
//   cells: Uint8/16/32/Array [a, b, c, a, b, c, ...],
// }

// Every geometry below, with its options set to their defaults. Grids
// return an n-gon complex: positions and cells only, no normals or uvs. Most
// plane geometries also have a `*Path` outline variant, and the polyhedra a
// `*Polygons` n-gon seed variant: see the API below.

// Plane
const quadGrid = Primitives.quadGrid({
  sx: 1,
  sy: 1,
  nx: 10,
  ny: 10,
});
const triangularGrid = Primitives.triangularGrid({
  sx: 1,
  nx: 10,
  ny: 10,
  inscribed: true,
});
const hexagonalGrid = Primitives.hexagonalGrid({
  sx: 1,
  nx: 10,
  ny: 10,
  inscribed: true,
});

const triangle = Primitives.triangle({
  sx: 1,
  sy: 1,
  apexOffset: 0,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.rectangular,
});
const rightTriangle = Primitives.rightTriangle({
  sx: 1,
  sy: 1,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.rectangular,
});

const quad = Primitives.quad({
  scale: 1,
});
const plane = Primitives.plane({
  sx: 1,
  sy: 1,
  nx: 1,
  ny: 1,
  direction: "z",
});
const roundedRectangle = Primitives.roundedRectangle({
  sx: 1,
  sy: 1,
  radius: 0.25,
  roundSegments: 8,
  nx: 1,
  ny: 1,
  roundedCorners: ["top-left", "top-right", "bottom-right", "bottom-left"],
});
const stadium = Primitives.stadium({
  sx: 1,
  sy: 0.5,
  nx: 1,
  ny: 1,
  roundSegments: 8,
});

const kite = Primitives.kite({
  sx: 1,
  sy: 1,
  ratio: 0.5,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: Math.PI / 2,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const rhombus = Primitives.rhombus({
  sx: 1,
  sy: 1,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: Math.PI / 2,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const lozenge = Primitives.lozenge({
  sx: 0.5,
  sy: 1,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: Math.PI / 2,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const trapezoid = Primitives.trapezoid({
  sx: 1,
  sy: 1,
  topRatio: 0.5,
  topOffset: 0,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.rectangular,
});
const parallelogram = Primitives.parallelogram({
  sx: 0.5,
  sy: 1,
  shear: 0.3,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.rectangular,
});

const arbelos = Primitives.arbelos({
  radius: 0.5,
  innerRadius: 0.125,
  segments: 32,
  innerSegments: 16,
  mapping: mappings.rectangular,
});
const lens = Primitives.lens({
  radius: 0.5,
  radius2: 0.5,
  distance: 0.5,
  segments: 32,
  innerSegments: 16,
  mapping: mappings.rectangular,
});
const lune = Primitives.lune({
  radius: 0.5,
  innerRadius: 0.5,
  distance: 0.25,
  segments: 32,
  innerSegments: 16,
  mapping: mappings.rectangular,
});
const salinon = Primitives.salinon({
  radius: 0.5,
  innerRadius: 0.125,
  segments: 32,
  innerSegments: 16,
  mapping: mappings.rectangular,
});
const triquetra = Primitives.triquetra({
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  mapping: mappings.rectangular,
});
const yinYang = Primitives.yinYang({
  radius: 0.5,
  dotRadius: 0.5 / 6,
  part: "yin-yang",
  segments: 32,
  holeSegments: 16,
  innerSegments: 16,
  mapping: mappings.rectangular,
});

const ellipse = Primitives.ellipse({
  sx: 1,
  sy: 0.5,
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  theta: Math.PI * 2,
  thetaOffset: 0,
  innerRadius: 0,
  mergeCentroid: true,
  mapping: mappings.elliptical,
});
const disc = Primitives.disc({
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const superellipse = Primitives.superellipse({
  sx: 1,
  sy: 0.5,
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.lamé,
  m: 2,
  n: 2,
});
const squircle = Primitives.squircle({
  sx: 1,
  sy: 1,
  radius: 0.5,
  segments: 128,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.fgSquircular,
  squareness: 0.95,
});
const astroid = Primitives.astroid({
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.lamé,
});
const annulus = Primitives.annulus({
  sx: 1,
  sy: 1,
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  theta: Math.PI * 2,
  thetaOffset: 0,
  innerRadius: 0.25,
  mapping: mappings.concentric,
});

const polygon = Primitives.polygon({
  sides: 6,
  sx: 1,
  sy: 1,
  radius: 0.5,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const reuleaux = Primitives.reuleaux({
  sides: 3,
  radius: 0.5,
  segments: 32,
  innerSegments: 16,
  innerRadius: 0,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const star = Primitives.star({
  points: 5,
  density: 2,
  radius: 0.5,
  notchRadius: 0.5 * utils.computeStarRatio(5, 2),
  innerRadius: 0,
  circularHole: false,
  edgeSegments: 1,
  innerSegments: 16,
  theta: Math.PI * 2,
  thetaOffset: 0,
  mergeCentroid: true,
  mapping: mappings.concentric,
});
const cross = Primitives.cross({
  radius: 0.5,
  armWidth: 0.5 / 3,
  edgeSegments: 1,
  innerSegments: 16,
  innerRadius: 0,
  mergeCentroid: true,
  mapping: mappings.rectangular,
});

// Solid
const cube = Primitives.cube({
  sx: 1,
  sy: 1,
  sz: 1,
  nx: 1,
  ny: 1,
  nz: 1,
});
const hollowCube = Primitives.hollowCube({
  sx: 1,
  sy: 1,
  sz: 1,
  thickness: 0.2,
});
const roundedCube = Primitives.roundedCube({
  sx: 1,
  sy: 1,
  sz: 1,
  radius: 0.25,
  roundSegments: 8,
  nx: 1,
  ny: 1,
  nz: 1,
  roundDirection: "all",
});

const sphere = Primitives.sphere({
  radius: 0.5,
  nx: 32,
  ny: 16,
  theta: Math.PI,
  thetaOffset: 0,
  phi: Math.PI * 2,
  phiOffset: 0,
});
const hollowSphere = Primitives.hollowSphere({
  radius: 0.5,
  innerRadius: 0.25,
  nx: 32,
  ny: 16,
  capSegments: 1,
  theta: Math.PI / 2,
  thetaOffset: Math.PI / 4,
  phi: Math.PI * 2,
  phiOffset: 0,
});
const ellipsoid = Primitives.ellipsoid({
  radius: 0.5,
  nx: 32,
  ny: 16,
  sx: 1,
  sy: 0.5,
  sz: 0.5,
  theta: Math.PI,
  thetaOffset: 0,
  phi: Math.PI * 2,
  phiOffset: 0,
  vDistribution: utils.linear,
});
const superellipsoid = Primitives.superellipsoid({
  radius: 0.5,
  nx: 32,
  ny: 16,
  sx: 1,
  sy: 0.5,
  sz: 0.5,
  n1: 3,
  n2: 3,
  theta: Math.PI,
  thetaOffset: 0,
  phi: Math.PI * 2,
  phiOffset: 0,
  vDistribution: utils.linear,
});
const astroidalEllipsoid = Primitives.astroidalEllipsoid({
  radius: 0.5,
  nx: 32,
  ny: 16,
  sx: 1,
  sy: 0.5,
  sz: 0.5,
  theta: Math.PI,
  thetaOffset: 0,
  phi: Math.PI * 2,
  phiOffset: 0,
});
const superegg = Primitives.superegg({
  radius: 0.5,
  sy: 5 / 6,
  nx: 32,
  ny: 16,
  n: 2.5,
  theta: Math.PI,
  thetaOffset: 0,
  phi: Math.PI * 2,
  phiOffset: 0,
  vDistribution: utils.linear,
});

const cylinder = Primitives.cylinder({
  height: 1,
  radiusBase: 0.25,
  radiusApex: 0.25,
  nx: 16,
  ny: 1,
  capBase: true,
  capApex: true,
  capBaseSegments: 1,
  capApexSegments: 1,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  sxBase: 1,
  szBase: 1,
  sxApex: 1,
  szApex: 1,
});
const hollowCylinder = Primitives.hollowCylinder({
  height: 1,
  radius: 0.5,
  innerRadius: 0.25,
  nx: 32,
  ny: 1,
  capSegments: 1,
  capApex: true,
  capBase: true,
  phi: Math.PI * 2,
  phiOffset: 0,
});
const roundedCylinder = Primitives.roundedCylinder({
  height: 1,
  radius: 0.25,
  roundRadius: 0.075,
  nx: 16,
  ny: 1,
  roundSegments: 8,
  capSegments: 1,
  phi: Math.PI * 2,
  phiOffset: 0,
});

const cone = Primitives.cone({
  height: 1,
  radius: 0.25,
  nx: 16,
  ny: 1,
  capSegments: 1,
  capBase: true,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  sx: 1,
  sz: 1,
});
const bicone = Primitives.bicone({
  height: 1,
  radius: 0.5,
  nx: 16,
  ny: 1,
  phi: Math.PI * 2,
  phiOffset: 0,
  sx: 1,
  sz: 1,
});
const sphericon = Primitives.sphericon({
  radius: 0.5,
  nx: 16,
  ny: 1,
});
const doubleCone = Primitives.doubleCone({
  height: 1,
  radius: 0.5,
  nx: 16,
  ny: 1,
  capBase: true,
  capApex: true,
  capBaseSegments: 1,
  capApexSegments: 1,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  sx: 1,
  sz: 1,
});
const capsule = Primitives.capsule({
  height: 0.5,
  radius: 0.25,
  nx: 16,
  ny: 1,
  roundSegments: 16,
  phi: Math.PI * 2,
  phiOffset: 0,
});

const torus = Primitives.torus({
  radius: 0.4,
  segments: 64,
  minorRadius: 0.1,
  minorSegments: 32,
  theta: Math.PI * 2,
  thetaOffset: 0,
  phi: Math.PI * 2,
  phiOffset: 0,
  capStart: true,
  capEnd: true,
  capStartSegments: 1,
  capEndSegments: 1,
  capMapping: mappings.rectangular,
  sx: 1,
  sy: 1,
  minorSx: 1,
  minorSy: 1,
});
const apple = Primitives.apple({
  radius: 0.5,
  height: 0.5,
  nx: 32,
  ny: 16,
  phi: Math.PI * 2,
  phiOffset: 0,
});
const lemon = Primitives.lemon({
  radius: 0.3,
  height: 1,
  nx: 32,
  ny: 16,
  phi: Math.PI * 2,
  phiOffset: 0,
});
const sphericalRing = Primitives.sphericalRing({
  radius: 0.5,
  innerRadius: 0.25,
  nx: 32,
  ny: 16,
  holeSegments: 1,
  phi: Math.PI * 2,
  phiOffset: 0,
});

const prism = Primitives.prism({
  radius: 0.25,
  height: 1,
  sides: 6,
  phiOffset: 0,
  capMapping: mappings.rectangular,
});
const antiprism = Primitives.antiprism({
  radius: 0.25,
  height: 1,
  sides: 6,
  phiOffset: 0,
  capMapping: mappings.rectangular,
});

const paraboloid = Primitives.paraboloid({
  height: 1,
  radius: 0.5,
  nx: 32,
  ny: 16,
  capSegments: 1,
  capBase: true,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  vDistribution: utils.linear,
});
const hyperboloid = Primitives.hyperboloid({
  height: 1,
  radius: 0.25,
  endRadius: 0.5,
  nx: 32,
  ny: 16,
  capSegments: 1,
  capApex: true,
  capBase: true,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  vDistribution: utils.linear,
});
const barrel = Primitives.barrel({
  height: 1,
  radius: 0.5,
  endRadius: 0.35,
  nx: 32,
  ny: 16,
  capSegments: 1,
  capApex: true,
  capBase: true,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  vDistribution: utils.linear,
});
const funnel = Primitives.funnel({
  height: 1,
  radiusBase: 0.1,
  radiusApex: 0.5,
  nx: 32,
  ny: 16,
  capBase: true,
  capApex: true,
  capBaseSegments: 1,
  capApexSegments: 1,
  phi: Math.PI * 2,
  phiOffset: 0,
  capMapping: mappings.rectangular,
  vDistribution: utils.linear,
});

const tetrahedron = Primitives.tetrahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const hexahedron = Primitives.hexahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const octahedron = Primitives.octahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const dodecahedron = Primitives.dodecahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const icosahedron = Primitives.icosahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});

const greatDodecahedron = Primitives.greatDodecahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const greatIcosahedron = Primitives.greatIcosahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const smallStellatedDodecahedron = Primitives.smallStellatedDodecahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});
const greatStellatedDodecahedron = Primitives.greatStellatedDodecahedron({
  radius: 0.5,
  subdivisions: 0,
  mapping: mappings.rectangular,
});

const tetrasphere = Primitives.tetrasphere({
  radius: 0.5,
  subdivisions: 2,
  projection: "gnomonic",
  mapping: mappings.spherical,
});
const hexasphere = Primitives.hexasphere({
  radius: 0.5,
  subdivisions: 2,
  projection: "gnomonic",
  mapping: mappings.spherical,
});
const octasphere = Primitives.octasphere({
  radius: 0.5,
  subdivisions: 2,
  projection: "gnomonic",
  mapping: mappings.spherical,
});
const dodecasphere = Primitives.dodecasphere({
  radius: 0.5,
  subdivisions: 2,
  projection: "gnomonic",
  mapping: mappings.spherical,
});
const icosphere = Primitives.icosphere({
  radius: 0.5,
  subdivisions: 2,
  projection: "gnomonic",
  mapping: mappings.spherical,
});

API

Modules

primitiveGeometry

Re-export all geometries, UV mappings functions and utils.

mappings
utils

Typedefs

TypedArrayLike : Array.<number> | Uint8Array | Uint16Array | Uint32Array
PositiveInteger : number

Integer >= 1.

NonNegativeInteger : number

Integer >= 0.

Angle : number

In radians.

PolarAngle : number

In radians, from the pole, within [0, π].

SimplicialComplex : object

Triangle cells over shared positions.

PolygonalComplex : object

Polygon cells over shared positions: each cell is a closed n-gon (implicitly wraps its last index back to its first - never repeat the first index at the end).

PolylineComplex : object

Polyline cells over shared positions: each cell is an open polyline (no implicit closing edge between its last and first index); repeat the first index at the end of a cell to close that loop explicitly.

primitiveGeometry

Re-export all geometries, UV mappings functions and utils.

primitiveGeometry.cross([options]) ⇒ SimplicialComplex

A Greek cross: 4 equal arms around a square center.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Greek Cross

Param Type Default
[options] CrossOptions {}

primitiveGeometry.crossPath([options]) ⇒ PolylineComplex

Outline dual of cross.

Kind: static method of primitiveGeometry

Param Type Default
[options] CrossPathOptions {}

primitiveGeometry.polygon([options]) ⇒ SimplicialComplex

A regular polygon, stretched when sx != sy.

Special cases: rhombus (sides = 4).

Kind: static method of primitiveGeometry

Param Type Default
[options] PolygonOptions {}

primitiveGeometry.polygonPath([options]) ⇒ PolylineComplex

Outline dual of polygon.

Kind: static method of primitiveGeometry

Param Type Default
[options] PolygonPathOptions {}

primitiveGeometry.reuleaux([options]) ⇒ SimplicialComplex

A Reuleaux polygon: a constant-width curve built from sides circular arcs, each centered on the opposite vertex. Defaults to a Reuleaux triangle.

Kind: static method of primitiveGeometry See: Parametric equations for regular and Reuleaux polygons

Param Type Default
[options] ReuleauxOptions {}

primitiveGeometry.reuleauxPath([options]) ⇒ PolylineComplex

Outline dual of reuleaux.

Kind: static method of primitiveGeometry

Param Type Default
[options] ReuleauxPathOptions {}

primitiveGeometry.star([options]) ⇒ SimplicialComplex

A regular {points/density} star polygon: the default is a pentagram.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Star Polygon

Param Type Default
[options] StarOptions {}

primitiveGeometry.starPath([options]) ⇒ PolylineComplex

Outline dual of star.

Kind: static method of primitiveGeometry

Param Type Default
[options] StarPathOptions {}

primitiveGeometry.arbelos([options]) ⇒ SimplicialComplex

An arbelos: a semicircle minus 2 tangent semicircles on its diameter.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Arbelos

Param Type Default
[options] ArbelosOptions {}

primitiveGeometry.lens([options]) ⇒ SimplicialComplex

A lens: the overlap of 2 circles. Defaults to a vesica piscis.

Kind: static method of primitiveGeometry See

Param Type Default
[options] LensOptions {}

primitiveGeometry.lune([options]) ⇒ SimplicialComplex

A lune: a big circle minus an offset small one.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Lune

Param Type Default
[options] LuneOptions {}

primitiveGeometry.salinon([options]) ⇒ SimplicialComplex

Archimedes' salinon: a shape bounded by 4 semicircles.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Salinon

Param Type Default
[options] SalinonOptions {}

primitiveGeometry.triquetra([options]) ⇒ SimplicialComplex

A triquetra: 3 interlaced lenses centered on an equilateral triangle.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Triquetra

Param Type Default
[options] TriquetraOptions {}

primitiveGeometry.yinYang([options]) ⇒ SimplicialComplex

A yin-yang (taijitu): a circle split by an S-curve, each half holed at the other's bulge.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Yin-Yang

Param Type Default
[options] YinYangOptions {}

primitiveGeometry.annulus([options]) ⇒ SimplicialComplex

An annulus (ring): the region between two concentric circles.

Kind: static method of primitiveGeometry

Param Type Default
[options] AnnulusOptions {}

primitiveGeometry.annulusPath([options]) ⇒ PolylineComplex

Outline dual of annulus: 2 path cells, outer loop first.

Kind: static method of primitiveGeometry

Param Type Default
[options] AnnulusPathOptions {}

primitiveGeometry.astroid([options]) ⇒ SimplicialComplex

A 4-cusped hypocycloid: superellipse with m = n = 2/3.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Astroid

Param Type Default
[options] AstroidOptions {}

primitiveGeometry.astroidPath([options]) ⇒ PolylineComplex

Outline dual of astroid.

Kind: static method of primitiveGeometry

Param Type Default
[options] AstroidPathOptions {}

primitiveGeometry.disc([options]) ⇒ SimplicialComplex

A disc: ellipse with sx = sy = 1.

Kind: static method of primitiveGeometry

Param Type Default
[options] DiscOptions {}

primitiveGeometry.circlePath([options]) ⇒ PolylineComplex

Outline dual of disc.

Kind: static method of primitiveGeometry

Param Type Default
[options] CirclePathOptions {}

primitiveGeometry.ellipse([options]) ⇒ SimplicialComplex

An ellipse (or circle when sx = sy).

Kind: static method of primitiveGeometry

Param Type Default
[options] EllipseOptions {}

primitiveGeometry.ellipsePath([options]) ⇒ PolylineComplex

Outline dual of ellipse.

Kind: static method of primitiveGeometry

Param Type Default
[options] EllipsePathOptions {}

primitiveGeometry.squircle([options]) ⇒ SimplicialComplex

A Fernández-Guasti squircle.

Special cases: circle (squareness → 0), square (squareness = 1).

Kind: static method of primitiveGeometry See: Squircular Calculations – Chamberlain Fong

Param Type Default
[options] SquircleOptions {}

primitiveGeometry.squirclePath([options]) ⇒ PolylineComplex

Outline dual of squircle.

Kind: static method of primitiveGeometry

Param Type Default
[options] SquirclePathOptions {}

primitiveGeometry.superellipse([options]) ⇒ SimplicialComplex

A superellipse (Lamé curve).

Special cases: squircle (m = 4), rectellipse (m = 4, sx != sy), astroid (m = 2/3), diamond (m = 1), Piet Hein's superellipse (m = 5/2).

Kind: static method of primitiveGeometry See

Param Type Default
[options] SuperellipseOptions {}

primitiveGeometry.superellipsePath([options]) ⇒ PolylineComplex

Outline dual of superellipse.

Kind: static method of primitiveGeometry

Param Type Default
[options] SuperellipsePathOptions {}

primitiveGeometry.hexagonalGrid([options]) ⇒ PolygonalComplex

A grid of regular hexagons.

Kind: static method of primitiveGeometry

Param Type Default
[options] HexagonalGridOptions {}

primitiveGeometry.quadGrid([options]) ⇒ PolygonalComplex

A grid of quads.

Kind: static method of primitiveGeometry

Param Type Default
[options] QuadGridOptions {}

primitiveGeometry.triangularGrid([options]) ⇒ PolygonalComplex

An isometric grid of equilateral triangles.

Kind: static method of primitiveGeometry

Param Type Default
[options] TriangularGridOptions {}

primitiveGeometry.kite([options]) ⇒ SimplicialComplex

A kite: a rhombus with its bottom vertex pulled toward the center.

Special cases: rhombus (ratio = 1).

Kind: static method of primitiveGeometry

Param Type Default
[options] KiteOptions {}

primitiveGeometry.kitePath([options]) ⇒ PolylineComplex

Outline dual of kite.

Kind: static method of primitiveGeometry

Param Type Default
[options] KitePathOptions {}

primitiveGeometry.lozenge([options]) ⇒ SimplicialComplex

A lozenge: rhombus with sy = sx * 2.

Kind: static method of primitiveGeometry

Param Type Default
[options] LozengeOptions {}

primitiveGeometry.lozengePath([options]) ⇒ PolylineComplex

Outline dual of lozenge.

Kind: static method of primitiveGeometry

Param Type Default
[options] LozengePathOptions {}

primitiveGeometry.parallelogram([options]) ⇒ SimplicialComplex

A parallelogram: trapezoid with topRatio = 1.

Kind: static method of primitiveGeometry

Param Type Default
[options] ParallelogramOptions {}

primitiveGeometry.parallelogramPath([options]) ⇒ PolylineComplex

Outline dual of parallelogram.

Kind: static method of primitiveGeometry

Param Type Default
[options] ParallelogramPathOptions {}

primitiveGeometry.plane([options]) ⇒ SimplicialComplex

A flat rectangular grid, facing direction.

Kind: static method of primitiveGeometry

Param Type Default
[options] PlaneOptions {}

primitiveGeometry.rectanglePath([options]) ⇒ PolylineComplex

Outline dual of plane, facing z.

Kind: static method of primitiveGeometry

Param Type Default
[options] RectanglePathOptions {}

primitiveGeometry.quad([options]) ⇒ SimplicialComplex

A square, filled with 2 triangles.

Kind: static method of primitiveGeometry

Param Type Default
[options] QuadOptions {}

primitiveGeometry.squarePath([options]) ⇒ PolylineComplex

Outline dual of quad.

Kind: static method of primitiveGeometry

Param Type Default
[options] SquarePathOptions {}

primitiveGeometry.rhombus([options]) ⇒ SimplicialComplex

A rhombus: polygon with 4 sides, sx/sy scaling its diagonals.

Special cases: square rotated 45° (sx = sy).

Kind: static method of primitiveGeometry

Param Type Default
[options] RhombusOptions {}

primitiveGeometry.rhombusPath([options]) ⇒ PolylineComplex

Outline dual of rhombus.

Kind: static method of primitiveGeometry

Param Type Default
[options] RhombusPathOptions {}

primitiveGeometry.roundedRectangle([options]) ⇒ SimplicialComplex

A rectangle with rounded corners.

Kind: static method of primitiveGeometry

Param Type Default
[options] RoundedRectangleOptions {}

primitiveGeometry.roundedRectanglePath([options]) ⇒ PolylineComplex

Outline dual of roundedRectangle.

Kind: static method of primitiveGeometry

Param Type Default
[options] RoundedRectanglePathOptions {}

primitiveGeometry.stadium([options]) ⇒ SimplicialComplex

A stadium (discorectangle): roundedRectangle with radius fixed to half the shorter side.

Kind: static method of primitiveGeometry

Param Type Default
[options] StadiumOptions {}

primitiveGeometry.stadiumPath([options]) ⇒ PolylineComplex

Outline dual of stadium.

Kind: static method of primitiveGeometry

Param Type Default
[options] StadiumPathOptions {}

primitiveGeometry.trapezoid([options]) ⇒ SimplicialComplex

A trapezoid with horizontal edges, swept CCW from the bottom-left corner.

Special cases: isosceles (topOffset = 0), parallelogram (topRatio = 1), triangle (topRatio = 0).

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Trapezoid

Param Type Default
[options] TrapezoidOptions {}

primitiveGeometry.trapezoidPath([options]) ⇒ PolylineComplex

Outline dual of trapezoid.

Kind: static method of primitiveGeometry

Param Type Default
[options] TrapezoidPathOptions {}

primitiveGeometry.rightTriangle([options]) ⇒ SimplicialComplex

A right triangle: triangle with apexOffset = -sx.

Kind: static method of primitiveGeometry

Param Type Default
[options] RightTriangleOptions {}

primitiveGeometry.rightTrianglePath([options]) ⇒ PolylineComplex

Outline dual of rightTriangle.

Kind: static method of primitiveGeometry

Param Type Default
[options] RightTrianglePathOptions {}

primitiveGeometry.triangle([options]) ⇒ SimplicialComplex

A triangle with a horizontal base, swept CCW from the bottom-left corner.

Special cases: isosceles (apexOffset = 0), right (apexOffset = ±sx), scalene otherwise.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Triangle

Param Type Default
[options] TriangleOptions {}

primitiveGeometry.trianglePath([options]) ⇒ PolylineComplex

Outline dual of triangle.

Kind: static method of primitiveGeometry

Param Type Default
[options] TrianglePathOptions {}

primitiveGeometry.cubePolygons([options]) ⇒ PolygonalComplex

Cuboid faces: 8 positions and 6 quads, ordered +x, -x, +y, -y, +z, -z.

Kind: static method of primitiveGeometry

Param Type Default
[options] CubePolygonsOptions {}

primitiveGeometry.cube([options]) ⇒ SimplicialComplex

A cuboid (rectangular box).

Kind: static method of primitiveGeometry

Param Type Default
[options] CubeOptions {}

primitiveGeometry.hollowCube([options]) ⇒ SimplicialComplex

A cube with a square hole through each face, like a Menger sponge cell.

Kind: static method of primitiveGeometry

Param Type Default
[options] HollowCubeOptions {}

primitiveGeometry.roundedCube([options]) ⇒ SimplicialComplex

A cuboid with rounded edges and corners.

Kind: static method of primitiveGeometry

Param Type Default
[options] RoundedCubeOptions {}

primitiveGeometry.antiprism([options]) ⇒ SimplicialComplex

An antiprism: a prism with its top rotated half a sector, joined by a band of triangles.

Kind: static method of primitiveGeometry

Param Type Default
[options] AntiprismOptions {}

primitiveGeometry.prism([options]) ⇒ SimplicialComplex

A right prism: a regular polygon extruded with flat-shaded sides.

Kind: static method of primitiveGeometry

Param Type Default
[options] PrismOptions {}

primitiveGeometry.apple([options]) ⇒ SimplicialComplex

An apple surface: the outer lobe of a spindle torus, dimpled at the poles.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Apple Surface

Param Type Default
[options] AppleOptions {}

primitiveGeometry.astroidalEllipsoid([options]) ⇒ SimplicialComplex

An astroidal ellipsoid: superellipsoid with n1 = n2 = 2/3, pinched to 6 cusps.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Astroidal Ellipsoid

Param Type Default
[options] AstroidalEllipsoidOptions {}

primitiveGeometry.barrel([options]) ⇒ SimplicialComplex

A barrel: a cylinder bulging at the equator.

Special cases: cylinder (endRadius = radius), pinched (endRadius > radius).

Kind: static method of primitiveGeometry

Param Type Default
[options] BarrelOptions {}

primitiveGeometry.bicone([options]) ⇒ SimplicialComplex

Two cones joined base to base.

Kind: static method of primitiveGeometry

Param Type Default
[options] BiconeOptions {}

primitiveGeometry.capsule([options]) ⇒ SimplicialComplex

A capsule: a cylinder capped with 2 hemispheres.

Special cases: open tube (roundSegments = 0).

Kind: static method of primitiveGeometry

Param Type Default
[options] CapsuleOptions {}

primitiveGeometry.cone([options]) ⇒ SimplicialComplex

A right circular cone.

Special cases: open cone (capBase = false), elliptical cone (sx != sz).

Kind: static method of primitiveGeometry

Param Type Default
[options] ConeOptions {}

primitiveGeometry.cylinder([options]) ⇒ SimplicialComplex

A right circular cylinder.

Special cases: tube (no caps), frustum (radiusApex != radiusBase), cone (radiusApex = 0), elliptical cylinder (sxBase != szBase, sxApex != szApex).

Kind: static method of primitiveGeometry

Param Type Default
[options] CylinderOptions {}

primitiveGeometry.doubleCone([options]) ⇒ SimplicialComplex

Two cones joined apex to apex.

Kind: static method of primitiveGeometry

Param Type Default
[options] DoubleConeOptions {}

primitiveGeometry.ellipsoid([options]) ⇒ SimplicialComplex

An ellipsoid, oblate by default.

Special cases: sphere (sx = sy = sz), prolate spheroid (sy > sx = sz).

Kind: static method of primitiveGeometry

Param Type Default
[options] EllipsoidOptions {}

primitiveGeometry.funnel([options]) ⇒ SimplicialComplex

A funnel: a logarithmic profile from spout to mouth.

Special cases: cylinder (radiusApex = radiusBase).

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Funnel

Param Type Default
[options] FunnelOptions {}

primitiveGeometry.hollowCylinder([options]) ⇒ SimplicialComplex

A cylinder with a concentric bore. A phi < TAU cut is left open.

Kind: static method of primitiveGeometry

Param Type Default
[options] HollowCylinderOptions {}

primitiveGeometry.hollowSphere([options]) ⇒ SimplicialComplex

A spherical shell. Defaults to a band, exposing the cavity.

Kind: static method of primitiveGeometry

Param Type Default
[options] HollowSphereOptions {}

primitiveGeometry.hyperboloid([options]) ⇒ SimplicialComplex

A hyperboloid of one sheet.

Special cases: cylinder (endRadius = radius).

Kind: static method of primitiveGeometry See: Wolfram MathWorld – One-Sheeted Hyperboloid

Param Type Default
[options] HyperboloidOptions {}

primitiveGeometry.lemon([options]) ⇒ SimplicialComplex

A lemon: a minor circular arc revolved about its chord, apple's complement.

Special cases: sphere (height = radius * 2).

Kind: static method of primitiveGeometry See: Wikipedia – Lemon (geometry)

Param Type Default
[options] LemonOptions {}

primitiveGeometry.paraboloid([options]) ⇒ SimplicialComplex

A circular paraboloid, apex up.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Paraboloid

Param Type Default
[options] ParaboloidOptions {}

primitiveGeometry.roundedCylinder([options]) ⇒ SimplicialComplex

A cylinder with filleted rims.

Special cases: cylinder (roundRadius = 0), capsule (roundRadius = radius).

Kind: static method of primitiveGeometry

Param Type Default
[options] RoundedCylinderOptions {}

primitiveGeometry.sphere([options]) ⇒ SimplicialComplex

A sphere: ellipsoid with sx = sy = 1.

Kind: static method of primitiveGeometry

Param Type Default
[options] SphereOptions {}

primitiveGeometry.sphericalRing([options]) ⇒ SimplicialComplex

A spherical ring (napkin ring): a sphere with a cylindrical bore.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Spherical Ring

Param Type Default
[options] SphericalRingOptions {}

primitiveGeometry.sphericon([options]) ⇒ SimplicialComplex

A sphericon: a bicone split through its apexes, one half turned 90°.

Kind: static method of primitiveGeometry See: Wolfram MathWorld – Sphericon

Param Type Default
[options] SphericonOptions {}

primitiveGeometry.superegg([options]) ⇒ SimplicialComplex

Piet Hein's superegg: a superellipsoid of revolution.

Special cases: spheroid (n = 2).

Kind: static method of primitiveGeometry See

Param Type Default
[options] SupereggOptions {}

primitiveGeometry.superellipsoid([options]) ⇒ SimplicialComplex

A superellipsoid: n > 2 rounds toward a box, n < 2 pinches.

Special cases: ellipsoid (n1 = n2 = 2), octahedron (n1 = n2 = 1), astroidal ellipsoid (n1 = n2 = 2/3), superegg-like (n2 = 2, sx = sz).

Kind: static method of primitiveGeometry See

Param Type Default
[options] SuperellipsoidOptions {}

primitiveGeometry.torus([options]) ⇒ SimplicialComplex

A ring torus.

Special cases: open torus (phi < TAU), elliptical torus (sx != sy), elliptical tube (minorSx != minorSy).

Kind: static method of primitiveGeometry

Param Type Default
[options] TorusOptions {}

primitiveGeometry.dodecasphere([options]) ⇒ SimplicialComplex

A geodesic sphere from a subdivided dodecahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] DodecasphereOptions {}

primitiveGeometry.hexasphere([options]) ⇒ SimplicialComplex

A geodesic sphere from a subdivided cube.

Kind: static method of primitiveGeometry

Param Type Default
[options] HexasphereOptions {}

primitiveGeometry.icosphere([options]) ⇒ SimplicialComplex

A geodesic sphere from a subdivided icosahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] IcosphereOptions {}

primitiveGeometry.octasphere([options]) ⇒ SimplicialComplex

A geodesic sphere from a subdivided octahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] OctasphereOptions {}

primitiveGeometry.tetrasphere([options]) ⇒ SimplicialComplex

A geodesic sphere from a subdivided tetrahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] TetrasphereOptions {}

primitiveGeometry.dodecahedronPolygons([options]) ⇒ PolygonalComplex

Regular dodecahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] DodecahedronPolygonsOptions {}

primitiveGeometry.dodecahedron([options]) ⇒ SimplicialComplex

Regular dodecahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] DodecahedronOptions {}

primitiveGeometry.greatDodecahedronPolygons([options]) ⇒ PolygonalComplex

Great dodecahedron faces: on the icosahedron's vertices, one pentagon per vertex's 5 neighbors.

Kind: static method of primitiveGeometry

Param Type Default
[options] GreatDodecahedronPolygonsOptions {}

primitiveGeometry.greatDodecahedron([options]) ⇒ SimplicialComplex

Great dodecahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] GreatDodecahedronOptions {}

primitiveGeometry.greatIcosahedronPolygons([options]) ⇒ PolygonalComplex

Great icosahedron faces: on the icosahedron's vertices, each triangle joining second-nearest neighbors.

Kind: static method of primitiveGeometry

Param Type Default
[options] GreatIcosahedronPolygonsOptions {}

primitiveGeometry.greatIcosahedron([options]) ⇒ SimplicialComplex

Great icosahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] GreatIcosahedronOptions {}

primitiveGeometry.greatStellatedDodecahedronPolygons([options]) ⇒ PolygonalComplex

Great stellated dodecahedron faces: the dodecahedron's outermost stellation.

Kind: static method of primitiveGeometry

Param Type Default
[options] GreatStellatedDodecahedronPolygonsOptions {}

primitiveGeometry.greatStellatedDodecahedron([options]) ⇒ SimplicialComplex

Great stellated dodecahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] GreatStellatedDodecahedronOptions {}

primitiveGeometry.hexahedronPolygons([options]) ⇒ PolygonalComplex

Regular hexahedron (cube) faces, ordered +x, -x, +y, -y, +z, -z.

Kind: static method of primitiveGeometry

Param Type Default
[options] HexahedronPolygonsOptions {}

primitiveGeometry.hexahedron([options]) ⇒ SimplicialComplex

Regular hexahedron (cube).

Kind: static method of primitiveGeometry

Param Type Default
[options] HexahedronOptions {}

primitiveGeometry.icosahedronPolygons([options]) ⇒ PolygonalComplex

Regular icosahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] IcosahedronPolygonsOptions {}

primitiveGeometry.icosahedron([options]) ⇒ SimplicialComplex

Regular icosahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] IcosahedronOptions {}

primitiveGeometry.octahedronPolygons([options]) ⇒ PolygonalComplex

Regular octahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] OctahedronPolygonsOptions {}

primitiveGeometry.octahedron([options]) ⇒ SimplicialComplex

Regular octahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] OctahedronOptions {}

primitiveGeometry.smallStellatedDodecahedronPolygons([options]) ⇒ PolygonalComplex

Small stellated dodecahedron faces: the great dodecahedron's, as pentagrams.

Kind: static method of primitiveGeometry

Param Type Default
[options] SmallStellatedDodecahedronPolygonsOptions {}

primitiveGeometry.smallStellatedDodecahedron([options]) ⇒ SimplicialComplex

Small stellated dodecahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] SmallStellatedDodecahedronOptions {}

primitiveGeometry.tetrahedronPolygons([options]) ⇒ PolygonalComplex

Regular tetrahedron, apex-up, bounding box centered at the origin.

Kind: static method of primitiveGeometry

Param Type Default
[options] TetrahedronPolygonsOptions {}

primitiveGeometry.tetrahedron([options]) ⇒ SimplicialComplex

Regular tetrahedron.

Kind: static method of primitiveGeometry

Param Type Default
[options] TetrahedronOptions {}

primitiveGeometry~CrossOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Distance from the center to each arm's tip.
[armWidth] number radius/3 Half-width of each arm. The default makes 5 equal squares.
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0 Hole radius, traced as a scaled cross. 0 fills to the center.
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.rectangular

primitiveGeometry~CrossPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[armWidth] number radius/3
[edgeSegments] PositiveInteger 1
[closed] boolean false

primitiveGeometry~PolygonOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sides] PositiveInteger 6
[sx] number 1
[sy] number 1
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~PolygonPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sides] PositiveInteger 6
[sx] number 1
[sy] number 1
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~ReuleauxOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sides] PositiveInteger 3
[radius] number 0.5
[segments] PositiveInteger 32
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~ReuleauxPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sides] PositiveInteger 3
[radius] number 0.5
[segments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~StarOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[points] PositiveInteger 5
[density] PositiveInteger 2 Schläfli skip factor: < points / 2, coprime with points for a non-compound star.
[radius] number 0.5
[notchRadius] number radius*computeStarRatio(points,density) Radius of the concave vertices between tips.
[innerRadius] number 0 Hole radius. 0 fills to the center.
[circularHole] boolean false Trace the hole as a circle instead of a scaled star.
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~StarPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[points] PositiveInteger 5
[density] PositiveInteger 2
[radius] number 0.5
[notchRadius] number radius*computeStarRatio(points,density)
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~ArbelosOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Outer semicircle radius.
[innerRadius] number radius*0.25 Left inner semicircle radius. The right one fills the rest.
[segments] PositiveInteger 32 Columns, left to right.
[innerSegments] PositiveInteger 16 Rows between the bottom and top boundaries.
[mapping] MappingFn mappings.rectangular Use uRatio/vRatio to follow the arcs.

primitiveGeometry~LensOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 First circle radius.
[radius2] number radius Second circle radius.
[distance] number radius Distance between centers.
[segments] PositiveInteger 32 Columns, left to right.
[innerSegments] PositiveInteger 16 Rows between the bottom and top boundaries.
[mapping] MappingFn mappings.rectangular Use uRatio/vRatio to follow the arcs.

primitiveGeometry~LuneOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Big circle radius.
[innerRadius] number radius Small circle radius.
[distance] number radius*0.5 Small circle center offset along +x. distance + innerRadius > radius for a crescent.
[segments] PositiveInteger 32 Columns, left to right.
[innerSegments] PositiveInteger 16 Rows between each half's boundaries.
[mapping] MappingFn mappings.rectangular Use uRatio/vRatio to follow the arcs.

primitiveGeometry~SalinonOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Bottom semicircle radius.
[innerRadius] number radius*0.25 Top central semicircle radius.
[segments] PositiveInteger 32 Columns, left to right.
[innerSegments] PositiveInteger 16 Rows between the bottom and top boundaries.
[mapping] MappingFn mappings.rectangular Use uRatio/vRatio to follow the arcs.

primitiveGeometry~TriquetraOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Radius of each circle, and distance between their centers.
[segments] PositiveInteger 32 Angular columns per piece.
[innerSegments] PositiveInteger 16 Rows between the two boundaries.
[mapping] MappingFn mappings.rectangular Use uRatio/vRatio to follow the arcs.

primitiveGeometry~YinYangOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Radius of the enclosing circle.
[dotRadius] number radius/6 Dot hole radius. 0 omits it.
[part] "yin" | "yang" | "yin-yang" "yin-yang" One half, or both merged in one mesh.
[segments] PositiveInteger 32 Rows along the outer circle and S-curve.
[holeSegments] PositiveInteger 16 Rows along a dot hole.
[innerSegments] PositiveInteger 16 Columns on each side of a dot hole.
[mapping] MappingFn mappings.rectangular Use uRatio/vRatio to follow the arcs.

primitiveGeometry~AnnulusOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 1
[radius] number 0.5
[segments] PositiveInteger 32
[innerSegments] PositiveInteger 16
[theta] Angle TAU
[thetaOffset] Angle 0
[innerRadius] number radius * 0.5
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~AnnulusPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[radius] number 0.5
[segments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[innerRadius] number radius * 0.5
[closed] boolean false

primitiveGeometry~AstroidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[segments] PositiveInteger 32
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.lamé

primitiveGeometry~AstroidPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[segments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~DiscOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[segments] PositiveInteger 32
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~CirclePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[segments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~EllipseOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 0.5
[radius] number 0.5
[segments] PositiveInteger 32
[innerSegments] PositiveInteger 16
[theta] Angle TAU
[thetaOffset] Angle 0
[innerRadius] number 0 Hole radius. 0 fills to the center.
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.elliptical
[equation] EllipseEquationFn Sample to [x, y] position. Defaults to the ellipse's arc.

primitiveGeometry~EllipseEquationFn ⇒ [x: number, y: number]

Kind: inner typedef of primitiveGeometry

Param Type Description
sample object
sample.rx number Scaled ring radius along x
sample.ry number Scaled ring radius along y
sample.cosTheta number
sample.sinTheta number
sample.s number Radius ratio (0..1, innerRadius to radius)
sample.t number Angle

primitiveGeometry~EllipsePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 0.5
[radius] number 0.5
[segments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~SquircleOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 1
[radius] number 0.5
[segments] PositiveInteger 128
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.fgSquircular
[squareness] number 0.95 In (0, 1]

primitiveGeometry~SquirclePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[radius] number 0.5
[segments] PositiveInteger 128
[theta] Angle TAU
[thetaOffset] Angle 0
[squareness] number 0.95
[closed] boolean false

primitiveGeometry~SuperellipseOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 0.5
[radius] number 0.5
[segments] PositiveInteger 32
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.lamé
[m] number 2
[n] number m

primitiveGeometry~SuperellipsePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 0.5
[radius] number 0.5
[segments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[m] number 2
[n] number m
[closed] boolean false

primitiveGeometry~HexagonalGridOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[nx] PositiveInteger 10
[ny] PositiveInteger 10
[inscribed] boolean true

primitiveGeometry~QuadGridOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number sx
[nx] PositiveInteger 10
[ny] PositiveInteger nx

primitiveGeometry~TriangularGridOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[nx] PositiveInteger 10
[ny] PositiveInteger 10
[inscribed] boolean true

primitiveGeometry~KiteOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 1
[ratio] number 0.5 Bottom vertex distance from the center, as a fraction of the top's.
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle HALF_PI
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~KitePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[ratio] number 0.5
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle HALF_PI
[closed] boolean false

primitiveGeometry~LozengeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 0.5
[sy] number sx*2
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle HALF_PI
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~LozengePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 0.5
[sy] number sx*2
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle HALF_PI
[closed] boolean false

primitiveGeometry~ParallelogramOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 0.5
[sy] number 1
[shear] number 0.3 Horizontal shift of the top edge.
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.rectangular

primitiveGeometry~ParallelogramPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 0.5
[sy] number 1
[shear] number 0.3
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~PlaneOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number sx
[nx] PositiveInteger 1
[ny] PositiveInteger nx
[direction] PlaneDirection "z"

primitiveGeometry~PlaneDirection : "x" | "-x" | "y" | "-y" | "z" | "-z"

Kind: inner typedef of primitiveGeometry

primitiveGeometry~RectanglePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 0.5
[nx] PositiveInteger 1 Segments along the bottom/top edges
[ny] PositiveInteger nx Segments along the left/right edges
[closed] boolean false

primitiveGeometry~QuadOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[scale] number 1 Side length.

primitiveGeometry~SquarePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[scale] number 1 Side length.
[nx] PositiveInteger 1 Segments along the bottom/top edges
[ny] PositiveInteger nx Segments along the left/right edges
[closed] boolean false

primitiveGeometry~RhombusOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number 1
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle HALF_PI
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.concentric

primitiveGeometry~RhombusPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle HALF_PI
[closed] boolean false

primitiveGeometry~RoundedRectangleCorner : "top-left" | "top-right" | "bottom-right" | "bottom-left"

Kind: inner typedef of primitiveGeometry

primitiveGeometry~RoundedRectangleOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number sx
[radius] number sx * 0.25
[roundSegments] PositiveInteger 8
[nx] PositiveInteger 1 Segments along the straight top/bottom sections.
[ny] PositiveInteger nx Segments along the straight left/right sections.
[roundedCorners] Array.<RoundedRectangleCorner> ["top-left", "top-right", "bottom-right", "bottom-left"]

primitiveGeometry~RoundedRectanglePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number sx
[radius] number sx * 0.25
[roundSegments] PositiveInteger 8
[nx] PositiveInteger 1
[ny] PositiveInteger nx
[roundedCorners] Array.<RoundedRectangleCorner> ["top-left", "top-right", "bottom-right", "bottom-left"]
[closed] boolean false

primitiveGeometry~StadiumOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 0.5
[nx] PositiveInteger 1
[ny] PositiveInteger nx
[roundSegments] PositiveInteger 8

primitiveGeometry~StadiumPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 0.5
[nx] PositiveInteger 1
[ny] PositiveInteger nx
[roundSegments] PositiveInteger 8
[closed] boolean false

primitiveGeometry~TrapezoidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1 Bottom edge half-width.
[sy] number 1 Half-height.
[topRatio] number 0.5 Top edge half-width, as a fraction of sx.
[topOffset] number 0 Horizontal shift of the top edge.
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU Negative values aren't supported.
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.rectangular

primitiveGeometry~TrapezoidPathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[topRatio] number 0.5
[topOffset] number 0
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~RightTriangleOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1 Horizontal leg half-length.
[sy] number 1 Vertical leg half-length.
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.rectangular

primitiveGeometry~RightTrianglePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~TriangleOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1 Base half-width.
[sy] number 1 Half-height.
[apexOffset] number 0 Horizontal apex shift.
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[innerSegments] PositiveInteger 16
[innerRadius] number 0
[theta] Angle TAU Negative values aren't supported.
[thetaOffset] Angle 0
[mergeCentroid] boolean "innerRadius === 0"
[mergeSeam] boolean true false splits the full turn's wrap edge for mappings wrapping there (eg. mappings.polar).
[mapping] MappingFn mappings.rectangular

primitiveGeometry~TrianglePathOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number 1
[apexOffset] number 0
[radius] number 0.5
[edgeSegments] PositiveInteger 1
[theta] Angle TAU
[thetaOffset] Angle 0
[closed] boolean false

primitiveGeometry~CubePolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number sx
[sz] number sx

primitiveGeometry~CubeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[sx] number 1
[sy] number sx
[sz] number sx
[nx] PositiveInteger 1
[ny] PositiveInteger nx
[nz] PositiveInteger nx

primitiveGeometry~HollowCubeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number sx
[sz] number sx
[thickness] number sx*0.2 Beam size, below half the smallest of sx/sy/sz.

primitiveGeometry~RoundedCubeDirection : "all" | "x" | "y" | "z"

Kind: inner typedef of primitiveGeometry

primitiveGeometry~RoundedCubeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[sx] number 1
[sy] number sx
[sz] number sx
[radius] number sx * 0.25
[roundSegments] PositiveInteger 8
[nx] PositiveInteger 1 Segments along the straight x sections.
[ny] PositiveInteger nx Segments along the straight y sections.
[nz] PositiveInteger nx Segments along the straight z sections.
[roundDirection] RoundedCubeDirection "all"

primitiveGeometry~AntiprismOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.25
[height] number 1
[sides] PositiveInteger 6
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[mergeSeam] boolean false true shares the caps' wrap column and center vertices, wrapping uvs back to 0 there.

primitiveGeometry~PrismOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.25
[height] number 1
[sides] PositiveInteger 6
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[mergeSeam] boolean false true shares the caps' wrap column and center vertices, wrapping uvs back to 0 there.

primitiveGeometry~AppleOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Equatorial radius.
[height] number radius Height between the dimples, clamped to (0, radius * 2].
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~AstroidalEllipsoidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[sx] number 1
[sy] number 0.5
[sz] number sy
[theta] PolarAngle Math.PI Meridian sweep length, clamped so poles stay at its ends.
[thetaOffset] PolarAngle 0 Meridian sweep start from the north pole, clamped to [0, π].
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~BarrelOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.5 Belly radius.
[endRadius] number radius*0.7 Rim radius.
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[capSegments] PositiveInteger 1
[capApex] boolean true
[capBase] boolean true
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~BiconeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.5
[nx] PositiveInteger 16
[ny] PositiveInteger 1 Meridian segments per cone.
[phi] Angle TAU
[phiOffset] Angle 0
[sx] number 1 Equator x scale.
[sz] number 1 Equator z scale.
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~CapsuleOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 0.5
[radius] number 0.25
[nx] PositiveInteger 16
[ny] PositiveInteger 1
[roundSegments] NonNegativeInteger 16
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~ConeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.25
[nx] PositiveInteger 16
[ny] PositiveInteger 1
[capSegments] PositiveInteger 1
[capBase] boolean true
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[sx] number 1 Base ring x scale.
[sz] number 1 Base ring z scale.
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~CylinderOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radiusBase] number 0.25
[radiusApex] number 0.25
[nx] PositiveInteger 16
[ny] PositiveInteger 1
[capBase] boolean true
[capApex] boolean true
[capBaseSegments] PositiveInteger 1
[capApexSegments] PositiveInteger 1
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[sxBase] number 1 Base ring x scale.
[szBase] number 1 Base ring z scale.
[sxApex] number 1 Apex ring x scale.
[szApex] number 1 Apex ring z scale.
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~DoubleConeOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.5
[nx] PositiveInteger 16
[ny] PositiveInteger 1 Meridian segments per cone.
[capBase] boolean true
[capApex] boolean true
[capBaseSegments] PositiveInteger 1
[capApexSegments] PositiveInteger 1
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[sx] number 1 End ring x scale.
[sz] number 1 End ring z scale.
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~EllipsoidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[sx] number 1
[sy] number 0.5
[sz] number sy
[theta] PolarAngle Math.PI Meridian sweep length, clamped so poles stay at its ends.
[thetaOffset] PolarAngle 0 Meridian sweep start from the north pole, clamped to [0, π].
[phi] Angle TAU
[phiOffset] Angle 0
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~FunnelOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radiusBase] number 0.1 Spout radius.
[radiusApex] number 0.5 Mouth radius.
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[capBase] boolean true
[capApex] boolean true
[capBaseSegments] PositiveInteger 1
[capApexSegments] PositiveInteger 1
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~HollowCylinderOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.5
[innerRadius] number radius*0.5 Bore radius.
[nx] PositiveInteger 32
[ny] PositiveInteger 1
[capSegments] PositiveInteger 1 Radial segments per cap.
[capApex] boolean true
[capBase] boolean true
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~HollowSphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[innerRadius] number radius*0.5
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[capSegments] PositiveInteger 1 Radial segments per cut cap.
[theta] PolarAngle Math.PI / 2 Meridian sweep length, clamped like ellipsoid's.
[thetaOffset] PolarAngle Math.PI / 4 Meridian sweep start, clamped like ellipsoid's.
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~HyperboloidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.25 Waist radius.
[endRadius] number radius*2 Rim radius.
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[capSegments] PositiveInteger 1
[capApex] boolean true
[capBase] boolean true
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~LemonOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.3 Equatorial radius.
[height] number 1 Height between the tips, raised to at least radius * 2.
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~ParaboloidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.5 Rim radius.
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[capSegments] PositiveInteger 1
[capBase] boolean true
[phi] Angle TAU
[phiOffset] Angle 0
[capMapping] MappingFn mappings.rectangular
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~RoundedCylinderOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[height] number 1
[radius] number 0.25
[roundRadius] number radius*0.3 Rim fillet radius, clamped to [0, min(radius, height / 2)].
[nx] PositiveInteger 16
[ny] PositiveInteger 1 Straight side segments.
[roundSegments] PositiveInteger 8 Fillet segments per end.
[capSegments] PositiveInteger 1 Flat cap segments per end.
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~SphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[theta] PolarAngle Math.PI
[thetaOffset] PolarAngle 0
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~SphericalRingOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Sphere radius.
[innerRadius] number radius*0.5 Bore radius, clamped to [0, radius].
[nx] PositiveInteger 32
[ny] PositiveInteger 16 Outer band meridian segments.
[holeSegments] PositiveInteger 1 Bore wall segments.
[phi] Angle TAU
[phiOffset] Angle 0
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~SphericonOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[nx] PositiveInteger 16 Segments per quarter-cone half-turn.
[ny] PositiveInteger 1 Meridian segments per quarter-cone.

primitiveGeometry~SupereggOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Equatorial radius
[sy] number 5/6 Vertical (polar) scale
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[n] number 2.5 Roundness exponent.
[theta] PolarAngle Math.PI Meridian sweep length, clamped so poles stay at its ends.
[thetaOffset] PolarAngle 0 Meridian sweep start from the north pole, clamped to [0, π].
[phi] Angle TAU
[phiOffset] Angle 0
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~SuperellipsoidOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5
[nx] PositiveInteger 32
[ny] PositiveInteger 16
[sx] number 1
[sy] number 0.5
[sz] number sy
[n1] number 3 Meridian roundness exponent.
[n2] number n1 Cross-section roundness exponent.
[theta] PolarAngle Math.PI Meridian sweep length, clamped so poles stay at its ends.
[thetaOffset] PolarAngle 0 Meridian sweep start from the north pole, clamped to [0, π].
[phi] Angle TAU
[phiOffset] Angle 0
[vDistribution] DistributionFn utils.linear
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~TorusOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.4
[segments] PositiveInteger 64
[minorRadius] number 0.1
[minorSegments] PositiveInteger 32
[theta] Angle TAU
[thetaOffset] Angle 0
[phi] Angle TAU
[phiOffset] Angle 0
[capStart] boolean true
[capEnd] boolean true
[capStartSegments] PositiveInteger 1
[capEndSegments] PositiveInteger 1
[capMapping] MappingFn mappings.rectangular
[sx] number 1 Footprint x scale.
[sy] number 1 Footprint y scale.
[minorSx] number 1 Tube radial scale.
[minorSy] number 1 Tube z scale.
[mergeSeam] boolean false true shares the full turn's wrap column and smooth poles' vertices, wrapping uvs back to 0 there.

primitiveGeometry~DodecasphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[subdivisions] NonNegativeInteger 2
[projection] "gnomonic" | "spherical" "gnomonic"
[mapping] MappingFn mappings.spherical

primitiveGeometry~HexasphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[subdivisions] NonNegativeInteger 2
[projection] "gnomonic" | "spherical" "gnomonic"
[mapping] MappingFn mappings.spherical

primitiveGeometry~IcosphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[subdivisions] NonNegativeInteger 2
[projection] "gnomonic" | "spherical" "gnomonic"
[mapping] MappingFn mappings.spherical

primitiveGeometry~OctasphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[subdivisions] NonNegativeInteger 2
[projection] "gnomonic" | "spherical" "gnomonic"
[mapping] MappingFn mappings.spherical

primitiveGeometry~TetrasphereOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default
[radius] number 0.5
[subdivisions] NonNegativeInteger 2
[projection] "gnomonic" | "spherical" "gnomonic"
[mapping] MappingFn mappings.spherical

primitiveGeometry~DodecahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~DodecahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~GreatDodecahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~GreatDodecahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~GreatIcosahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~GreatIcosahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~GreatStellatedDodecahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~GreatStellatedDodecahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~HexahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~HexahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~IcosahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~IcosahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~OctahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~OctahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~SmallStellatedDodecahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.

primitiveGeometry~SmallStellatedDodecahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

primitiveGeometry~TetrahedronPolygonsOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[center] boolean true Center the bounding box. false centers the centroid, keeping vertices on the circumsphere.

primitiveGeometry~TetrahedronOptions : object

Kind: inner typedef of primitiveGeometry Properties

Name Type Default Description
[radius] number 0.5 Circumradius.
[subdivisions] NonNegativeInteger 0
[mapping] MappingFn mappings.rectangular

mappings

mappings.rectangular() : MappingFn

Kind: static method of mappings

mappings.circumferential() : MappingFn

Solid caps only: centered, undistorted and at the same scale as the body's u around the rim.

Kind: static method of mappings

mappings.polar() : MappingFn

Kind: static method of mappings

mappings.spherical() : MappingFn

Kind: static method of mappings

mappings.radial() : MappingFn

Kind: static method of mappings

mappings.concentric() : MappingFn

Kind: static method of mappings

mappings.lamé() : MappingFn

Kind: static method of mappings

mappings.elliptical() : MappingFn

Kind: static method of mappings

mappings.fgSquircular() : MappingFn

Kind: static method of mappings

mappings.twoSquircular() : MappingFn

Kind: static method of mappings

mappings.threeSquircular() : MappingFn

Kind: static method of mappings

mappings.cornerificTapered2() : MappingFn

Kind: static method of mappings

mappings.tapered4() : MappingFn

Kind: static method of mappings

mappings.nonAxial2Pinch() : MappingFn

Kind: static method of mappings

mappings.nonAxialHalfPinch() : MappingFn

Kind: static method of mappings

mappings.squelched() : MappingFn

Kind: static method of mappings

mappings.squelchedVertical() : MappingFn

Kind: static method of mappings

mappings.squelchedHorizontal() : MappingFn

Kind: static method of mappings

mappings~MappingFn ⇒ void

Kind: inner typedef of mappings

Param Type Description
mappingOptions object
[mappingOptions.uvs] Float32Array
[mappingOptions.index] number
[mappingOptions.x] number
[mappingOptions.y] number
[mappingOptions.u] number
[mappingOptions.v] number
[mappingOptions.radius] number
[mappingOptions.nx] number
[mappingOptions.ny] number
[mappingOptions.nz] number
[mappingOptions.sx] number
[mappingOptions.sy] number
[mappingOptions.t] number
[mappingOptions.radiusRatio] number
[mappingOptions.thetaRatio] number
[mappingOptions.perimeter] number Cap rim length, solid caps only

utils

utils.TAU : number

Two times PI.

Kind: static constant of utils

utils.HALF_PI : number

Half of PI.

Kind: static constant of utils

utils.SQRT2 : number

Square root of 2.

Kind: static constant of utils

utils.SQRT3 : number

Square root of 3.

Kind: static constant of utils

utils.SQRT6 : number

Square root of 6.

Kind: static constant of utils

utils.PHI : number

Golden ratio: (1 + √5) / 2.

Kind: static constant of utils

utils.getCellsTypedArray ⇒ Uint8Array | Uint16Array | Uint32Array

Select the smallest cells typed array fitting size.

Kind: static constant of utils See: MDN TypedArray objects

Param Type Description
size number The max value expected

utils.fullscreenTriangle() ⇒ Object

A single triangle covering clip space, for fullscreen passes. xy positions only.

Kind: static method of utils

utils.setTypedArrayType(type)

Enforce a typed array constructor for cells.

Kind: static method of utils

Param Type
type Uint8ArrayConstructor | Uint16ArrayConstructor | Uint32ArrayConstructor

utils.triangulateFaces(cells, numVertices) ⇒ Uint8Array | Uint16Array | Uint32Array

Fan-triangulate convex, planar polygon cells.

Kind: static method of utils

Param Type Description
cells Array.<TypedArrayLike>
numVertices number Picks the typed array size

utils.concatGeometries(geometries) ⇒ SimplicialComplex

Concatenate geometries, without welding coincident positions.

Kind: static method of utils

Param Type
geometries Array.<SimplicialComplex>

utils.invert(geometry) ⇒ SimplicialComplex

Flip a geometry inside out: negated normals, reversed winding.

Kind: static method of utils

Param Type
geometry SimplicialComplex

utils.linear() : DistributionFn

Uniform spacing, the default vDistribution.

vDistribution remaps rows along meridians not swept at constant speed: ellipsoid, superellipsoid, superegg, paraboloid, barrel, funnel and hyperboloid.

Kind: static method of utils

utils.chebyshev() : DistributionFn

Chebyshev spacing: clusters rows toward both ends, eg. a prolate ellipsoid's poles.

Kind: static method of utils

utils.smoothstep() : DistributionFn

Smoothstep spacing: clusters rows toward both ends, like chebyshev.

Kind: static method of utils

utils.power([exponent]) ⇒ function

Power spacing: clusters rows toward t = 1. 2 evens out paraboloid's apex.

Kind: static method of utils

Param Type Default
[exponent] number 2

utils.splitSeam(geometry, [options]) ⇒ SimplicialComplex

Split vertices along a periodic uv seam (eg. polar's v or spherical's u wrapping from 1 back to 0) so each triangle interpolates a continuous range.

Can't fix a triangle spanning half the wrap or more on its own (eg. a 3-segment disc): only splitting the triangle would.

Kind: static method of utils Returns: SimplicialComplex - A new geometry, or the input one when no seam is found.

Param Type Default Description
geometry SimplicialComplex
[options] object {}
[options.component] number 0 The uv component wrapping at 0/1: 0 for u, 1 for v.
[options.isPole] function Vertices with no value of their own in that component (eg. a sphere's poles, a fan's centroid): duplicated per triangle, midway between the two other corners.

utils~DistributionFn ⇒ number

Kind: inner typedef of utils

Param Type
t number

TypedArrayLike : Array.<number> | Uint8Array | Uint16Array | Uint32Array

Kind: global typedef

PositiveInteger : number

Integer >= 1.

Kind: global typedef

NonNegativeInteger : number

Integer >= 0.

Kind: global typedef

Angle : number

In radians.

Kind: global typedef

PolarAngle : number

In radians, from the pole, within [0, π].

Kind: global typedef

SimplicialComplex : object

Triangle cells over shared positions.

Kind: global typedef Properties

Name Type
positions Float32Array
normals Float32Array
uvs Float32Array
cells Uint8Array | Uint16Array | Uint32Array

PolygonalComplex : object

Polygon cells over shared positions: each cell is a closed n-gon (implicitly wraps its last index back to its first - never repeat the first index at the end).

Kind: global typedef Properties

Name Type
positions Float32Array
[normals] Float32Array
[uvs] Float32Array
cells Array.<TypedArrayLike>

PolylineComplex : object

Polyline cells over shared positions: each cell is an open polyline (no implicit closing edge between its last and first index); repeat the first index at the end of a cell to close that loop explicitly.

Kind: global typedef Properties

Name Type
positions Float32Array
cells Array.<TypedArrayLike>

License

See original packages used in v1:

v3: geometry generators consolidation and expansion

v2 differences with v1:

  • use 3D positions for circle
  • base disc on ellispse and add inner segments
  • fix cylinder orientation and uvs
  • fix icosphere uvs (based on: https://github.com/mourner/icomesh)
  • fix quad normal to +z
  • fix subdivision for rounded geometries (rounded-cube and capsule)
  • uniformise api and internal names
  • use options object
  • remove gl-matrix/pex-math and icosphere dependencies
  • use only trigonometric operation, no matrix transformation
  • base sphere on ellispsoid
  • add cone based on cylinder
  • use flat typed arrays
  • defaults produce geometries contained in a unit bbox
  • add jsdoc, prettier, eslint via snowdev

MIT. See license file.