Skip to main content

vJSONHilbertCurve

Generate the points of a Hilbert curve of a chosen order, scaled and offset in Z.

BeginnerMograph / JSONJSONArrayScriptVal
vJSONHilbertCurve node

vJSONHilbertCurve has no input and outputs the vertices of a Hilbert space-filling curve in the XY plane. Order sets the detail, Scale the size and Z Offset the height.

Parameters​

ParameterTypeDefaultDescription
OrderInteger3Recursion depth of the curve. Range 1 to 8, default 3. Side length is 2^order.
ScaleFloat1Size of the curve. Default 1.
Z OffsetFloat0Z value assigned to all points. Default 0.
Read the full description

The curve visits every cell of a grid with side 2^Order, so it has side * side points. Each point is centred on the origin: ((x / (side - 1)) - 0.5) * Scale for X and the same for Y. Z is set to Z Offset for all points.

The defaults (order 3, scale 1, Z offset 0) give 64 points spanning -0.5 to 0.5. Order ranges from 1 to 8, and the point count quadruples with each step, so order 8 outputs 65536 points.

Points come out in curve order. Drawing them as a connected path shows the curve; drawing them as separate points shows the grid.

Example Connections​

vJSONHilbertCurve.Output -> vJSONCameraProjection.ArrayA
vJSONCameraProjection.Output -> vJSONShapeRender.ArrayPoint
Background.Output -> vJSONShapeRender.Input