Hilbert Curve of order 4:
Hilbert Curve of order 6:
Code is in the JEQL script repo.import jeql.std.function.HashFunction;
hilbertOrder = 6;
side = Val.toInt( Math.pow(2, hilbertOrder) );
count = side * side;
radius = 1;
t = select * from Generate.sequence( 0, count-2 );
t = select i, geom: Geom.buffer(hilbertEdge, 0.4)
let
hilbertPt1 = HashFunction.hilbertPoint(hilbertOrder, i),
hilbertPt2 = HashFunction.hilbertPoint(hilbertOrder, i+1),
hilbertEdge = Geom.createLineFromPoints( hilbertPt1, hilbertPt2 )
from t;
t1 = select *,
styleFill: clr, styleStroke: clr, styleStrokeWidth: 1
let
clr = Color.toRGBfromHSV(Val.toDouble(i) / count, 1, 1)
from t;
Mem t1;
The function hilbertPoint uses the efficient algorithm from http://threadlocalmutex.com/. Code is on Github.
No comments:
Post a Comment