diff --git a/README.md b/README.md index 3fb692de..48c048c3 100644 --- a/README.md +++ b/README.md @@ -250,7 +250,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp - [mz_square_cells](https://openhome.cc/eGossip/OpenSCAD/lib2x-mz_square_cells.html) - [mz_square_get](https://openhome.cc/eGossip/OpenSCAD/lib2x-mz_square_get.html) - [mz_square_walls](https://openhome.cc/eGossip/OpenSCAD/lib2x-mz_square_walls.html) -- mz_hex_walls +- [mz_hex_walls](https://openhome.cc/eGossip/OpenSCAD/lib2x-mz_hex_walls.html) - mz_square_initialize - mz_hamiltonian diff --git a/docs/images/lib2x-mz_hex_walls-1.JPG b/docs/images/lib2x-mz_hex_walls-1.JPG new file mode 100644 index 00000000..306ee5c0 Binary files /dev/null and b/docs/images/lib2x-mz_hex_walls-1.JPG differ diff --git a/docs/lib2x-mz_hex_walls.md b/docs/lib2x-mz_hex_walls.md new file mode 100644 index 00000000..04b264ed --- /dev/null +++ b/docs/lib2x-mz_hex_walls.md @@ -0,0 +1,34 @@ +# mz_hex_walls + +It's a helper for creating wall data from maze cells. You can transform wall points for creating different types of mazes. + +**Since:** 2.5 + +## Parameters + +- `cells` : Maze cells. +- `rows` : The rows of the maze. +- `columns` : The columns of the maze. +- `cell_radius` : The radius of a cell. +- `left_border` : Default to `true`. Create the leftmost border of the maze. +- `bottom_border` : Default to `true`. Create the bottommost border of the maze. + +## Examples + + use ; + use ; + use ; + + rows = 10; + columns = 12; + cell_width = 5; + wall_thickness = 2; + + cells = mz_square_cells(rows, columns); + walls = mz_hex_walls(cells, rows, columns, cell_width); + + for(wall = walls) { + hull_polyline2d(wall, wall_thickness, $fn = 24); + } + +![mz_hex_walls](images/lib2x-mz_hex_walls-1.JPG) \ No newline at end of file diff --git a/src/maze/mz_hex_walls.scad b/src/maze/mz_hex_walls.scad index af1485cf..d52a8316 100644 --- a/src/maze/mz_hex_walls.scad +++ b/src/maze/mz_hex_walls.scad @@ -1,3 +1,13 @@ +/** +* mz_hex_walls.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-mz_hex_walls.html +* +**/ + use <_impl/_mz_hex_walls.scad>; function mz_hex_walls(cells, rows, columns, cell_radius, wall_thickness, left_border = true, bottom_border = true) =