 Easy to design line grids, line labyrinths

Based on the questions and answers in

I realized the construction of easy to design line grids. With this you can easily create 2D line labyrinths. The design elements used in the above solutions can be combined into one design.
The line grid can either be created in the xy-plane, or you can design grids on the sides of a box.

The size of the box is determined by the design by default, but can also be specified as required.
The length of the first line in the design of each side is decisive for the centering of the design. You can easily change the centering by using blanks at the beginning and end.

If the design results in double lines at one position, the surplus line is eliminated. A little binary arithmetic is enough.

// delete double lines, uses 0bLeftFrontRightBack

for( let r = 1; r < rows; r ++ ) {

cols = g.binDsgn[ s ][ r ].length;

for( let c = 0; c < cols; c ++ ) {

g.binDsgn[ s ][ r ][ c ] = ( ( g.binDsgn[ s ][ r - 1 ][ c ] & 0b0001 ) << 2 ) ^ g.binDsgn[ s ][ r ][ c ];

}

}

for( let r = 0; r < rows; r ++ ) {

cols = g.binDsgn[ s ][ r ].length;

for( let c = 1; c < cols; c ++ ) {

g.binDsgn[ s ][ r ][ c ] = ( ( g.binDsgn[ s ][ r ][ c - 1 ] & 0b0010 ) << 2 ) ^ g.binDsgn[ s ][ r ][ c ];

}

}

for( let r = 0; r < rows; r ++ ) {

cols = g.binDsgn[ s ][ r ].length;

for( let c = 0; c < cols; c ++ ) {

bin = g.binDsgn[ s ][ r ][ c ];

g.lineCount += ( ( bin & 0b1000 ) >> 3 ) + ( ( bin & 0b0100 ) >> 2 ) + ( ( bin & 0b0010 ) >> 1 ) + ( bin & 0b0001 );

}

}

Multi material is supported in ‘side’ and ‘align’ modes.

There you can see an example.
http://threejs.hofk.de/LineGridDesign/LineGridDesign.html

Soon in addon THREEg also on Github.
It will also soon be added to the Grid Collection .

3 Likes