mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-01-16 21:58:26 +01:00
add doc
This commit is contained in:
parent
2cf3ac6781
commit
631e78d642
@ -421,5 +421,6 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
[**maze/mz_squarewalls**(cells, cell_width[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_squarewalls.html) | a helper for creating square wall data from maze cells.
|
||||
[**maze/mz_hexwalls**(cells, cell_radius[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hexwalls.html) | a helper for creating hex wall data from maze cells.
|
||||
[**maze/mz_theta**(rings, beginning_number[, start, seed])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta.html) | return cell data of a theta maze.
|
||||
[**maze/mz_tiles**(cells[, left_border, bottom_border])](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_tiles.html) | return cell data of a theta maze.
|
||||
|
||||
----
|
BIN
docs/images/lib3x-mz_tiles-1.JPG
Normal file
BIN
docs/images/lib3x-mz_tiles-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
BIN
docs/images/lib3x-mz_tiles-2.JPG
Normal file
BIN
docs/images/lib3x-mz_tiles-2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
BIN
docs/images/lib3x-mz_tiles-3.JPG
Normal file
BIN
docs/images/lib3x-mz_tiles-3.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
75
docs/lib3x-mz_tiles.md
Normal file
75
docs/lib3x-mz_tiles.md
Normal file
@ -0,0 +1,75 @@
|
||||
# mz_tiles
|
||||
|
||||
It turns maze cells into tiles. The retured tiles have a data structure `[x, y, n]`, where `n` is a tile index 0 ~ 15 of the tileset.
|
||||
|
||||
![mz_tiles](images/lib3x-mz_tiles-1.JPG)
|
||||
|
||||
Just replace the tiles with your own path designs.
|
||||
|
||||
**Since:** 3.3
|
||||
|
||||
## Parameters
|
||||
|
||||
- `cells` : Maze cells.
|
||||
- `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 <maze/mz_square_initialize.scad>
|
||||
use <maze/mz_square.scad>
|
||||
use <maze/mz_tiles.scad>
|
||||
use <util/rand.scad>
|
||||
|
||||
rows = 10;
|
||||
columns = 10;
|
||||
|
||||
cells = mz_square(rows, columns);
|
||||
|
||||
tiles = mz_tiles(cells);
|
||||
|
||||
tile_width = 30;
|
||||
for(tile = tiles) {
|
||||
translate([tile.x, tile.y] * tile_width)
|
||||
tile(tile[2], tile_width);
|
||||
}
|
||||
|
||||
module tile(type, width) {
|
||||
// true 表示該方向有通道
|
||||
roads = [
|
||||
[false, false, false, false],
|
||||
[true, false, false, false],
|
||||
[false, true, false, false],
|
||||
[true, true, false, false],
|
||||
[false, false, true, false],
|
||||
[true, false, true, false],
|
||||
[false, true, true, false],
|
||||
[true, true, true, false],
|
||||
[false, false, false, true],
|
||||
[true, false, false, true],
|
||||
[false, true, false, true],
|
||||
[true, true, false, true],
|
||||
[false, false, true, true],
|
||||
[true, false, true, true],
|
||||
[false, true, true, true],
|
||||
[true, true, true, true]
|
||||
];
|
||||
|
||||
difference() {
|
||||
square(width, center = true);
|
||||
|
||||
for(i = [0:3]) {
|
||||
if(roads[type][i]) {
|
||||
rotate(-90 * i)
|
||||
translate([-width / 4, -width / 4])
|
||||
square([width / 2, width]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
![mz_tiles](images/lib3x-mz_tiles-2.JPG)
|
||||
|
||||
An advanced model.
|
||||
|
||||
[![mz_tiles](images/lib3x-mz_tiles-3.JPG)](https://cults3d.com/en/3d-model/art/maze-city)
|
@ -6,8 +6,6 @@ new:
|
||||
|
||||
- triangle/tri_subdivide
|
||||
|
||||
- maze/mz_tiles?
|
||||
|
||||
- mz_hamiltonian supports init_cells
|
||||
|
||||
update doc mz_square_initialize
|
||||
@ -33,6 +31,6 @@ doc-ed
|
||||
|
||||
new:
|
||||
- util/sorted, util/binary_search, util/contains
|
||||
- maze/mz_square, maze/mz_theta, maze/mz_squarewalls, maze/mz_hexwalls
|
||||
- maze/mz_square, maze/mz_theta, maze/mz_squarewalls, maze/mz_hexwalls, maze/mz_tiles
|
||||
- matrix/m_replace
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user