mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-18 20:41:18 +02:00
add mz_squarewalls
This commit is contained in:
@@ -9,4 +9,5 @@ new:
|
|||||||
- noise/worley_sphere?
|
- noise/worley_sphere?
|
||||||
- voronoi/vrn_sphere?
|
- voronoi/vrn_sphere?
|
||||||
- t3d - roll/pitch/forward
|
- t3d - roll/pitch/forward
|
||||||
- polyline_join: doc multi-childs
|
- polyline_join: doc multi-childs
|
||||||
|
- mz_squarewalls
|
28
src/maze/mz_squarewalls.scad
Normal file
28
src/maze/mz_squarewalls.scad
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/**
|
||||||
|
* mz_square_walls.scad
|
||||||
|
*
|
||||||
|
* @copyright Justin Lin, 2020
|
||||||
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
|
*
|
||||||
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square_walls.html
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
|
use <_impl/_mz_square_walls_impl.scad>;
|
||||||
|
|
||||||
|
function mz_squarewalls(cells, cell_width, left_border = true, bottom_border = true) =
|
||||||
|
let(
|
||||||
|
rows = len([for(cell = cells) if(cell.y == 0) undef]),
|
||||||
|
columns = len(cells) - rows,
|
||||||
|
left_walls = left_border ? [for(y = [0:rows - 1]) [[0, cell_width * (y + 1)], [0, cell_width * y]]] : [],
|
||||||
|
buttom_walls = bottom_border ? [for(x = [0:columns - 1]) [[cell_width * x, 0], [cell_width * (x + 1), 0]]] : []
|
||||||
|
)
|
||||||
|
concat(
|
||||||
|
[
|
||||||
|
for(cell = cells)
|
||||||
|
let(wall_pts = _square_walls(cell, cell_width))
|
||||||
|
if(wall_pts != [])
|
||||||
|
len(wall_pts) == 4 ? [wall_pts[0], wall_pts[1], wall_pts[3]]: wall_pts
|
||||||
|
]
|
||||||
|
, left_walls, buttom_walls
|
||||||
|
);
|
Reference in New Issue
Block a user