Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Core API Reference

Standard Library Functions

Built-in functions available in the default scope or via import "std".

Math

  • sin(rad), cos(rad), tan(rad)
  • asin(v), acos(v), atan(v)
  • sqrt(n), abs(n), pow(n, exp)
  • min(a, b), max(a, b)
  • floor(n), ceil(n), round(n)
  • PI: Constant (3.14159...)

Collections

  • avg(array): Returns average of numbers.
  • print(args...): Prints to console.
  • Grid(start, step, count): Generates an arithmetic sequence.

Array Methods

  • array.fold(reducer, initial): Reduces array to single value.
  • array.map(lambda): Transforms each element.
  • array.filter(lambda): Selects elements.
  • array.count / array.length: Number of elements.
import "std"

sum := (1..10).fold((acc, x) => acc + x, 0)

Geometry Constructors

Primitives

  • Vector(x, y, z): Creates a Vector.
  • Point(x, y, z): Creates a Point.
  • Normal(elev, index): Creates a normal Vector from machine angles (elevation, index). Requires Gear().
  • Normal(elev, azim): Creates a normal Vector from spherical coordinates (elevation, azimuth).
  • Plane(normal, dist): Creates a Plane.
  • Line(origin, dir): Creates a Line.

Solids

  • Cube(size): Creates a Cube centered at origin.
  • Octahedron(size): Creates an Octahedron.
  • Hull(geometry...): computes the convex hull of the provided points/planes.

Symmetry

  • Rotate(axis, order): Creates a rotational symmetry group of order n around axis.
  • Mirror(plane): Creates a reflection symmetry group across plane.

Global Configuration

  • Gear(n): Sets the index gear (e.g., 96). Enables Index Mode.
  • RI(n): Sets the Refractive Index.
  • Mode(s): Sets the angle mode ("deg" or "index").