Skip to content
Shapemetry

@huukhanhnguyen/types / geometry/core

geometry/core

Axis

Axis = { direction: Vector; origin: Point; }

The infinite line through origin along the UNIT direction, oriented: reversing direction gives a different axis while the locus stays the same — which is what makes an axis able to carry a revolve's orientation.

THE infinite-line type of the math core (CLAUDE.md type law, 2026-08-11): one carrier per dimension, no separate Line type. NOT a bounded segment — two endpoints are LineCurve (curve.ts). Plane twin: Axis2d (core2d.ts).

Structured form used at package boundaries. The wasm kernel wire is flat [px, py, pz, dx, dy, dz] (crates/geometry/src/types.rs Axis) — convert at the door (catalog/axis.ts).

direction

direction: Vector

origin

origin: Point


BoundingBox

BoundingBox = { max: Point; min: Point; }

Axis-aligned box in 3D (default space). Same stem as geometry BoundingBox ops namespace (type/value dual). Plane twin: BoundingBox2d (core2d.ts).

Structured form used at package boundaries (min/max points). The wasm kernel wire remains flat [minX,minY,minZ,maxX,maxY,maxZ] on op returns — convert at the door when needed.

max

max: Point

min

min: Point


Color

Color = [number, number, number]

RGB triple in 0..255. Channels outside the range are not clamped here — a consumer interprets as it sees fit. Not a spatial Point: it shares the layout and nothing else, which is why it is its own name.


Plane

Plane = { normal: Vector; point: Point; }

An unbounded plane through point with the given normal.

normal

normal: Vector

point

point: Point


Point

Point = [number, number, number]

3D point (default space). Same stem as geometry Point namespace.


Quaternion

Quaternion = [number, number, number, number]

Unit rotation [x, y, z, w].


Transformation

Transformation = number[]

A flat 4×4 affine matrix, 16 numbers.

Major order depends on the USE and the two are NOT interchangeable, so every field carrying this type states its own convention: placement transforms are COLUMN-major (Three.Matrix4 / SketchUp Geom::Transformation, translation at 12,13,14), while a face's uvMatrix is ROW-major (plane→world frame, origin at 3,7,11).


Vector

Vector = [number, number, number]

Free 3D vector (direction / axis). Same layout as Point; field role differs.

Last updated: 📖 2 min readEdit on GitHub