three-hilbert-geometry
v1.2.0
Published
ThreeJS geometry for drawing a Hilbert curve segment
Readme
ThreeJS Hilbert Geometry
A Three.js geometry for constructing a square-tube Hilbert curve with a recursive 3D path.
Quick start
import HilbertGeometry from 'three-hilbert-geometry';or using a script tag:
<script src="//unpkg.com/three-hilbert-geometry"></script>then
const myMesh = new THREE.Mesh(
new HilbertGeometry(5, 0, 128),
new THREE.MeshBasicMaterial({ color: 'blue' })
);Why this geometry?
The Hilbert curve is a space-filling path that preserves locality: adjacent points in the curve stay close in 3D space. This makes it useful for:
- Visualizing recursive structures and fractal ordering
- Building dense, ordered paths in 3D scenes
- Generating procedural line-like geometry with a compact footprint
- Creating animated or data-driven spatial layouts
API reference
Constructor
HilbertGeometry(order: Integer, start: Number | BigInt, length: Number | BigInt, options: Object)
Creates a square-tubed Hilbert curve segment. The geometry is built from a recursive 3D Hilbert path and then expanded into a thickened square tube.
- order: Recursion depth of the Hilbert curve. Higher values create finer, more detailed curves.
- start: Index of the first point to generate. Accepts a number or bigint for large ranges.
- length: Number of curve points to include. Also accepts a number or bigint.
- options: Optional settings object.
- padding: Fractional relative padding between of the tube. Value is in the range
[0, 1). Default is0. - paddingAbsolute: Absolute padding in world units. Default is
0. - simplifyCurves: If
true, the curve is simplified by reducing the order whenever possible when bothstartandlengthare divisible by 8. Default istrue.
- padding: Fractional relative padding between of the tube. Value is in the range
