1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-24 01:22:27 +01:00

add sphere_maze

This commit is contained in:
Justin Lin 2020-02-09 17:11:38 +08:00
parent 195bf91850
commit 2b121d386b

View File

@ -0,0 +1,38 @@
use <hull_polyline3d.scad>;
use <rotate_p.scad>;
use <square_maze.scad>;
use <matrix/m_rotation.scad>;
use <experimental/pt_to_sphere.scad>;
r = 10;
rows = 24;
columns = 18;
block_width = 1;
wall_thickness = .5;
pole_offset = block_width * 1.5;
module sphere_maze() {
size = [rows * block_width, columns * block_width + pole_offset * 2];
blocks = go_maze(
1, 1, // starting point
starting_maze(rows, columns),
rows, columns, y_circular = true
);
p_offset = [wall_thickness * columns, pole_offset, 0];
mr = m_rotation(90);
walls = maze_walls(blocks, rows, columns, block_width, bottom_border = false);
for(wall_pts = walls) {
rxpts = [
for(p = wall_pts)
pt_to_sphere(mr * [p[0], p[1], 0, 0] + p_offset, size, r)
];
hull_polyline3d(rxpts, wall_thickness, $fn = 6);
}
}
sphere_maze();
color("black")
rotate([0, 90, 0])
sphere(r);