mesh.box

An axis-aligned box of eight points and six outward quads.

GeometricSince 0.3.0

Usage

TypeScript
Mesh.box(size?: Vector3, center?: Point3): Result<Mesh>

Parameters

  • sizeVector3

    Edge lengths along x, y and z. Default Vector3.of(1, 1, 1). In model.

  • centerPoint3

    Centre of the box. Default Point3.origin. In model.

Returns

Ok with a closed, edge-manifold, outward box.

Errors

Guarantees

  • validate() succeeds
  • volume() equals size.x · size.y · size.z
  • The same result on every machine.

Example

TypeScript
const r = Mesh.box(Vector3.of(2, 1, 1))
r.ok && r.value.volume() // → { ok: true, value: 2, … }