mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-04-20 06:02:05 +02:00
add doc
This commit is contained in:
parent
731c87610d
commit
b9112d3076
@ -269,4 +269,4 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
||||
- [maze/mz_square_initialize](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_square_initialize.html)
|
||||
- [maze/mz_hamiltonian](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_hamiltonian.html)
|
||||
- [maze/mz_theta_cells](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta_cells.html)
|
||||
- `maze/mz_theta_get`
|
||||
- [maze/mz_theta_get](https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta_get.html)
|
BIN
docs/images/lib3x-mz_theta_get-1.JPG
Normal file
BIN
docs/images/lib3x-mz_theta_get-1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 44 KiB |
@ -1,13 +1,13 @@
|
||||
# mz_square_get
|
||||
|
||||
It's a helper for getting data from a maze cell.
|
||||
It's a helper for getting data from a square-maze cell.
|
||||
|
||||
**Since:** 2.5
|
||||
|
||||
## Parameters
|
||||
|
||||
- `cell` : A maze cell.
|
||||
- `query` : Accepts `"x"`, `"y"` or `"t"`. `"x"` for the cell's x coordinate. `"y"` for the cell's y coordinate. `"t"` for the cell's type. The returned type will be `"NO_WALL"`, `"TOP_WALL"`, `"RIGHT_WALL"`, `"TOP_RIGHT_WALL"` or `"MASK"`.
|
||||
- `query` : Accepts `"x"`, `"y"` or `"t"`. `"x"` for the cell's x coordinate. `"y"` for the cell's y coordinate. `"t"` for the cell's `type`. The returned type will be `"NO_WALL"`, `"TOP_WALL"`, `"RIGHT_WALL"`, `"TOP_RIGHT_WALL"` or `"MASK"`.
|
||||
|
||||
## Examples
|
||||
|
||||
|
59
docs/lib3x-mz_theta_get.md
Normal file
59
docs/lib3x-mz_theta_get.md
Normal file
@ -0,0 +1,59 @@
|
||||
# mz_theta_get
|
||||
|
||||
It's a helper for getting data from a theta-maze cell.
|
||||
|
||||
**Since:** 3.0
|
||||
|
||||
## Parameters
|
||||
|
||||
- `cell` : A maze cell.
|
||||
- `query` : Accepts `"r"`, `"c"` or `"t"`. `"r"` for the cell's `ri`. `"c"` for the cell's `ci` coordinate. `"t"` for the cell's `type`. The returned type will be `"NO_WALL"`, `"INWARD_WALL"`, `"CCW_WALL"` or `"INWARD_CCW_WALL"`.
|
||||
|
||||
## Examples
|
||||
|
||||
use <maze/mz_theta_cells.scad>;
|
||||
use <maze/mz_theta_get.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
|
||||
rows = 8;
|
||||
beginning_number = 8;
|
||||
cell_width = 10;
|
||||
wall_thickness = 2;
|
||||
|
||||
function vt_from_angle(theta, r) = [r * cos(theta), r * sin(theta)];
|
||||
|
||||
maze = mz_theta_cells(rows, beginning_number);
|
||||
for(rows = maze) {
|
||||
for(cell = rows) {
|
||||
ri = mz_theta_get(cell, "r");
|
||||
ci = mz_theta_get(cell, "c");
|
||||
type = mz_theta_get(cell, "t");
|
||||
thetaStep = 360 / len(maze[ri]);
|
||||
innerR = (ri + 1) * cell_width;
|
||||
outerR = (ri + 2) * cell_width;
|
||||
theta1 = thetaStep * ci;
|
||||
theta2 = thetaStep * (ci + 1);
|
||||
|
||||
innerVt1 = vt_from_angle(theta1, innerR);
|
||||
innerVt2 = vt_from_angle(theta2, innerR);
|
||||
outerVt2 = vt_from_angle(theta2, outerR);
|
||||
|
||||
if(type == "INWARD_WALL" || type == "INWARD_CCW_WALL") {
|
||||
hull_polyline2d([innerVt1, innerVt2], width = wall_thickness);
|
||||
}
|
||||
|
||||
if(type == "CCW_WALL" || type == "INWARD_CCW_WALL") {
|
||||
hull_polyline2d([innerVt2, outerVt2], width = wall_thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
thetaStep = 360 / len(maze[rows - 1]);
|
||||
r = cell_width * (rows + 1);
|
||||
for(theta = [0:thetaStep:360 - thetaStep]) {
|
||||
vt1 = vt_from_angle(theta, r);
|
||||
vt2 = vt_from_angle(theta + thetaStep, r);
|
||||
hull_polyline2d([vt1, vt2], width = wall_thickness);
|
||||
}
|
||||
|
||||

|
@ -1,3 +1,13 @@
|
||||
/**
|
||||
* mz_theta_get.scad
|
||||
*
|
||||
* @copyright Justin Lin, 2020
|
||||
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||
*
|
||||
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-mz_theta_get.html
|
||||
*
|
||||
**/
|
||||
|
||||
function mz_theta_get(cell, query) =
|
||||
let(
|
||||
i = search(query, [
|
||||
|
Loading…
x
Reference in New Issue
Block a user