mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 04:51:26 +02:00
rename block to cell
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
use <square_maze.scad>;
|
||||
|
||||
maze_rows = 8;
|
||||
block_width = 2;
|
||||
cell_width = 2;
|
||||
wall_thickness = 1;
|
||||
inner_cube = true;
|
||||
travel_all = true;
|
||||
|
||||
module cube_maze(maze_rows, block_width, wall_thickness, inner_cube, travel_all) {
|
||||
blocks_size = block_width * maze_rows;
|
||||
cube_size = blocks_size - wall_thickness;
|
||||
maze_size = blocks_size + wall_thickness;
|
||||
module cube_maze(maze_rows, cell_width, wall_thickness, inner_cube, travel_all) {
|
||||
cells_size = cell_width * maze_rows;
|
||||
cube_size = cells_size - wall_thickness;
|
||||
maze_size = cells_size + wall_thickness;
|
||||
|
||||
half_wall_thickness = wall_thickness / 2;
|
||||
half_cube_size = cube_size / 2;
|
||||
@@ -21,7 +21,7 @@ module cube_maze(maze_rows, block_width, wall_thickness, inner_cube, travel_all)
|
||||
module one_maze() {
|
||||
translate([origin, origin, half_cube_size])
|
||||
linear_extrude(wall_thickness)
|
||||
square_maze(maze_rows, block_width, wall_thickness);
|
||||
square_maze(maze_rows, cell_width, wall_thickness);
|
||||
}
|
||||
|
||||
one_maze();
|
||||
@@ -64,4 +64,4 @@ module cube_maze(maze_rows, block_width, wall_thickness, inner_cube, travel_all)
|
||||
}
|
||||
}
|
||||
|
||||
cube_maze(maze_rows, block_width, wall_thickness, inner_cube, travel_all);
|
||||
cube_maze(maze_rows, cell_width, wall_thickness, inner_cube, travel_all);
|
||||
|
@@ -1,10 +1,10 @@
|
||||
use <bend.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
|
||||
radius = 30;
|
||||
height = 60;
|
||||
block_width = 8;
|
||||
cell_width = 8;
|
||||
|
||||
wall_thickness = 5;
|
||||
wall_height = 5;
|
||||
@@ -32,19 +32,19 @@ module cylinder_maze() {
|
||||
}
|
||||
}
|
||||
|
||||
maze_rows = round(height / block_width);
|
||||
maze_columns = round(2 * 3.14159 * radius / block_width);
|
||||
maze_rows = round(height / cell_width);
|
||||
maze_columns = round(2 * 3.14159 * radius / cell_width);
|
||||
|
||||
maze_blocks = mz_square_blocks(
|
||||
maze_cells = mz_square_cells(
|
||||
maze_rows, maze_columns,
|
||||
x_wrapping = true
|
||||
);
|
||||
|
||||
walls = mz_square_walls(maze_blocks, maze_rows, maze_columns, block_width, left_border = false);
|
||||
walls = mz_square_walls(maze_cells, maze_rows, maze_columns, cell_width, left_border = false);
|
||||
|
||||
leng_circumference = block_width * maze_columns + wall_thickness;
|
||||
leng_circumference = cell_width * maze_columns + wall_thickness;
|
||||
|
||||
bend(size = [leng_circumference, block_width * maze_rows + wall_thickness, wall_height], angle = 360 + 360 * wall_thickness / leng_circumference, frags = fn)
|
||||
bend(size = [leng_circumference, cell_width * maze_rows + wall_thickness, wall_height], angle = 360 + 360 * wall_thickness / leng_circumference, frags = fn)
|
||||
translate([0, wall_thickness / 2])
|
||||
for(wall = walls) {
|
||||
for(i = [0:len(wall) - 2]) {
|
||||
|
@@ -1,14 +1,14 @@
|
||||
use <regular_polygon_maze.scad>;
|
||||
use <hollow_out.scad>;
|
||||
|
||||
cblocks = 8;
|
||||
ccells = 8;
|
||||
wall_thickness = 1.5;
|
||||
spacing = 0.6;
|
||||
$fn = 48;
|
||||
|
||||
gyro_maze(cblocks, wall_thickness, spacing);
|
||||
gyro_maze(ccells, wall_thickness, spacing);
|
||||
|
||||
module gyro_maze(cblocks, wall_thickness, spacing) {
|
||||
module gyro_maze(ccells, wall_thickness, spacing) {
|
||||
// Don't change these variables. They require more math.
|
||||
radius = 15;
|
||||
wall_height = 1;
|
||||
@@ -20,7 +20,7 @@ module gyro_maze(cblocks, wall_thickness, spacing) {
|
||||
linear_extrude(wall_height)
|
||||
scale(1.029) {
|
||||
difference() {
|
||||
regular_polygon_maze(radius - wall_thickness, cblocks, levels - 1, wall_thickness, $fn);
|
||||
regular_polygon_maze(radius - wall_thickness, ccells, levels - 1, wall_thickness, $fn);
|
||||
circle(radius / 3.5);
|
||||
}
|
||||
circle(radius / 3.5 - wall_thickness / 1.45);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
use <arc.scad>;
|
||||
use <heart_maze.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
|
||||
names = ["Justin", "Monica"];
|
||||
font_name = "Arial Black";
|
||||
@@ -9,7 +9,7 @@ font_size = 8;
|
||||
radius_of_heart = 15;
|
||||
tip_r_of_heart = 5;
|
||||
wall_thickness = 2.5;
|
||||
cblocks = 6;
|
||||
ccells = 6;
|
||||
levels = 3;
|
||||
spacing = 0.4;
|
||||
|
||||
@@ -30,14 +30,14 @@ module heart_base(name, font_name, font_size, radius, ring_thickness, tip_r_of_h
|
||||
arc(radius = radius / 3, angle = [25, 155], width = ring_thickness);
|
||||
}
|
||||
|
||||
module heart2heart_maze(names, font_name, font_size, radius_of_heart, tip_r_of_heart, wall_thickness, cblocks, levels, spacing) {
|
||||
maze = mz_square_blocks(
|
||||
cblocks, levels, y_wrapping = true
|
||||
module heart2heart_maze(names, font_name, font_size, radius_of_heart, tip_r_of_heart, wall_thickness, ccells, levels, spacing) {
|
||||
maze = mz_square_cells(
|
||||
ccells, levels, y_wrapping = true
|
||||
);
|
||||
|
||||
translate([0, 0, wall_thickness])
|
||||
linear_extrude(wall_thickness)
|
||||
heart_maze(maze, radius_of_heart, cblocks, levels, wall_thickness);
|
||||
heart_maze(maze, radius_of_heart, ccells, levels, wall_thickness);
|
||||
heart_base(names[0], font_name, font_size, radius_of_heart + wall_thickness / 2, wall_thickness, tip_r_of_heart);
|
||||
|
||||
translate([radius_of_heart * 4, 0, 0]) {
|
||||
@@ -50,9 +50,9 @@ module heart2heart_maze(names, font_name, font_size, radius_of_heart, tip_r_of_h
|
||||
heart(radius_of_heart, tip_r_of_heart);
|
||||
linear_extrude(wall_thickness * 2)
|
||||
offset(delta = spacing)
|
||||
heart_maze(maze, radius_of_heart, cblocks, levels, wall_thickness);
|
||||
heart_maze(maze, radius_of_heart, ccells, levels, wall_thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
heart2heart_maze(names, font_name, font_size, radius_of_heart, tip_r_of_heart, wall_thickness, cblocks, levels, spacing);
|
||||
heart2heart_maze(names, font_name, font_size, radius_of_heart, tip_r_of_heart, wall_thickness, ccells, levels, spacing);
|
@@ -2,14 +2,14 @@ use <line2d.scad>;
|
||||
use <hollow_out.scad>;
|
||||
use <ellipse_extrude.scad>;
|
||||
use <arc.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_get.scad>;
|
||||
|
||||
radius_of_heart = 12;
|
||||
height_of_heart = 25;
|
||||
tip_r_of_heart = 5;
|
||||
wall_thickness = 2;
|
||||
cblocks = 6;
|
||||
ccells = 6;
|
||||
levels = 3;
|
||||
|
||||
$fn = 36;
|
||||
@@ -58,17 +58,17 @@ module heart_to_heart_wall(radius, length, angle, thickness) {
|
||||
}
|
||||
}
|
||||
|
||||
module heart_maze(maze, radius, cblocks, levels, thickness = 1) {
|
||||
function no_wall(block) = get_wall_type(block) == "NO_WALL";
|
||||
function top_wall(block) = get_wall_type(block) == "TOP_WALL";
|
||||
function right_wall(block) = get_wall_type(block) == "RIGHT_WALL";
|
||||
function top_right_wall(block) = get_wall_type(block) == "TOP_RIGHT_WALL";
|
||||
module heart_maze(maze, radius, ccells, levels, thickness = 1) {
|
||||
function no_wall(cell) = get_wall_type(cell) == "NO_WALL";
|
||||
function top_wall(cell) = get_wall_type(cell) == "TOP_WALL";
|
||||
function right_wall(cell) = get_wall_type(cell) == "RIGHT_WALL";
|
||||
function top_right_wall(cell) = get_wall_type(cell) == "TOP_RIGHT_WALL";
|
||||
|
||||
function get_x(block) = mz_square_get(block, "x");
|
||||
function get_y(block) = mz_square_get(block, "y");
|
||||
function get_wall_type(block) = mz_square_get(block, "w");
|
||||
function get_x(cell) = mz_square_get(cell, "x");
|
||||
function get_y(cell) = mz_square_get(cell, "y");
|
||||
function get_wall_type(cell) = mz_square_get(cell, "w");
|
||||
|
||||
arc_angle = 360 / cblocks;
|
||||
arc_angle = 360 / ccells;
|
||||
r = radius / (levels + 1);
|
||||
|
||||
difference() {
|
||||
@@ -79,13 +79,13 @@ module heart_maze(maze, radius, cblocks, levels, thickness = 1) {
|
||||
|
||||
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
cell = maze[i];
|
||||
cr = get_x(cell) + 1;
|
||||
cc = get_y(cell);
|
||||
|
||||
angle = cc * arc_angle;
|
||||
|
||||
if(top_wall(block) || top_right_wall(block)) {
|
||||
if(top_wall(cell) || top_right_wall(cell)) {
|
||||
heart_to_heart_wall(r * cr, r, cc * arc_angle , thickness);
|
||||
}
|
||||
}
|
||||
@@ -94,11 +94,11 @@ module heart_maze(maze, radius, cblocks, levels, thickness = 1) {
|
||||
render() union() {
|
||||
// road to the next level
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
cell = maze[i];
|
||||
cr = get_x(cell) + 1;
|
||||
cc = get_y(cell);
|
||||
|
||||
if(no_wall(block) || top_wall(block)) {
|
||||
if(no_wall(cell) || top_wall(cell)) {
|
||||
ring_heart_sector(r * (cr + 1), (cc + 0.5) * arc_angle , thickness, thickness * 0.75);
|
||||
}
|
||||
}
|
||||
@@ -106,8 +106,8 @@ module heart_maze(maze, radius, cblocks, levels, thickness = 1) {
|
||||
}
|
||||
}
|
||||
|
||||
maze = mz_square_blocks(
|
||||
cblocks, levels, y_wrapping = true
|
||||
maze = mz_square_cells(
|
||||
ccells, levels, y_wrapping = true
|
||||
);
|
||||
|
||||
intersection() {
|
||||
@@ -121,7 +121,7 @@ intersection() {
|
||||
}
|
||||
|
||||
linear_extrude(height_of_heart, center = true)
|
||||
heart_maze(maze, radius_of_heart, cblocks, levels, wall_thickness);
|
||||
heart_maze(maze, radius_of_heart, ccells, levels, wall_thickness);
|
||||
}
|
||||
|
||||
linear_extrude(wall_thickness * 2, center = true)
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <maze/mz_square_initialize.scad>;
|
||||
use <voxel/vx_contour.scad>;
|
||||
@@ -18,18 +18,18 @@ mask = [
|
||||
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
];
|
||||
|
||||
block_width = 3;
|
||||
cell_width = 3;
|
||||
wall_thickness = 1;
|
||||
wall_height = 2;
|
||||
base_height = 1;
|
||||
contour = true;
|
||||
base = true;
|
||||
|
||||
module maze_masking(start, mask, block_width, wall_thickness, wall_height, base_height, contour, base) {
|
||||
module maze_masking(start, mask, cell_width, wall_thickness, wall_height, base_height, contour, base) {
|
||||
rows = len(mask);
|
||||
columns = len(mask[0]);
|
||||
|
||||
blocks = mz_square_blocks(
|
||||
cells = mz_square_cells(
|
||||
rows, columns, start,
|
||||
mz_square_initialize(mask = mask)
|
||||
);
|
||||
@@ -41,7 +41,7 @@ module maze_masking(start, mask, block_width, wall_thickness, wall_height, base_
|
||||
[x, y]
|
||||
], sorted = true) : [];
|
||||
|
||||
walls = mz_square_walls(blocks, rows, columns, block_width);
|
||||
walls = mz_square_walls(cells, rows, columns, cell_width);
|
||||
|
||||
color("gray")
|
||||
linear_extrude(wall_height)
|
||||
@@ -62,8 +62,8 @@ module maze_masking(start, mask, block_width, wall_thickness, wall_height, base_
|
||||
for(y = [0:rows - 1]) {
|
||||
for(x = [0:columns - 1]) {
|
||||
if(mask[rows - y - 1][x] == 0) {
|
||||
translate([x * block_width + wall_thickness, y * block_width + wall_thickness])
|
||||
square(block_width);
|
||||
translate([x * cell_width + wall_thickness, y * cell_width + wall_thickness])
|
||||
square(cell_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ module maze_masking(start, mask, block_width, wall_thickness, wall_height, base_
|
||||
|
||||
if(contour) {
|
||||
translate([wall_thickness * 2, wall_thickness * 2])
|
||||
polygon(pts * block_width);
|
||||
polygon(pts * cell_width);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,15 +80,15 @@ module maze_masking(start, mask, block_width, wall_thickness, wall_height, base_
|
||||
translate([0, 0, -base_height])
|
||||
linear_extrude(base_height)
|
||||
translate([wall_thickness * 2, wall_thickness * 2])
|
||||
polygon(pts * block_width);
|
||||
polygon(pts * cell_width);
|
||||
}
|
||||
else {
|
||||
translate([0, 0, -base_height])
|
||||
linear_extrude(base_height)
|
||||
translate([wall_thickness, wall_thickness])
|
||||
square([columns, rows] * block_width);
|
||||
square([columns, rows] * cell_width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
maze_masking(start, mask, block_width, wall_thickness, wall_height, base_height, contour, base);
|
||||
maze_masking(start, mask, cell_width, wall_thickness, wall_height, base_height, contour, base);
|
@@ -1,27 +1,27 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <ptf/ptf_ring.scad>;
|
||||
|
||||
rows = 48;
|
||||
columns = 8;
|
||||
block_width = 2;
|
||||
cell_width = 2;
|
||||
wall_thickness = 1;
|
||||
angle = 180;
|
||||
// $fn = 24;
|
||||
|
||||
leng = rows * block_width;
|
||||
leng = rows * cell_width;
|
||||
radius = 0.5 * leng / PI;
|
||||
a_step = 360 / leng;
|
||||
|
||||
blocks = mz_square_blocks(
|
||||
cells = mz_square_cells(
|
||||
rows, columns,
|
||||
y_wrapping = true
|
||||
);
|
||||
|
||||
walls = mz_square_walls(blocks, rows, columns, block_width, bottom_border = false);
|
||||
walls = mz_square_walls(cells, rows, columns, cell_width, bottom_border = false);
|
||||
|
||||
size = [columns * block_width, rows * block_width];
|
||||
size = [columns * cell_width, rows * cell_width];
|
||||
for(wall_pts = walls) {
|
||||
transformed = [for(pt = wall_pts) ptf_ring(size, pt, radius, 360, angle)];
|
||||
hull_polyline3d(transformed, wall_thickness);
|
||||
|
@@ -1,18 +1,18 @@
|
||||
use <hull_polyline2d.scad>;
|
||||
use <util/rand.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <ptf/ptf_circle.scad>;
|
||||
use <noise/nz_perlin2.scad>;
|
||||
|
||||
module noisy_circle_maze(r_blocks, block_width, wall_thickness, origin_offset, noisy_factor) {
|
||||
double_r_blocks = r_blocks * 2;
|
||||
blocks = mz_square_blocks(
|
||||
double_r_blocks, double_r_blocks
|
||||
module noisy_circle_maze(r_cells, cell_width, wall_thickness, origin_offset, noisy_factor) {
|
||||
double_r_cells = r_cells * 2;
|
||||
cells = mz_square_cells(
|
||||
double_r_cells, double_r_cells
|
||||
);
|
||||
|
||||
width = double_r_blocks * block_width;
|
||||
walls = mz_square_walls(blocks, double_r_blocks, double_r_blocks, block_width);
|
||||
width = double_r_cells * cell_width;
|
||||
walls = mz_square_walls(cells, double_r_cells, double_r_cells, cell_width);
|
||||
|
||||
half_width = width / 2;
|
||||
rect_size = is_undef(origin_offset) ? [width, width] : [width, width] - origin_offset * 2;
|
||||
@@ -34,8 +34,8 @@ module noisy_circle_maze(r_blocks, block_width, wall_thickness, origin_offset, n
|
||||
}
|
||||
|
||||
noisy_circle_maze(
|
||||
r_blocks = 8,
|
||||
block_width = 5,
|
||||
r_cells = 8,
|
||||
cell_width = 5,
|
||||
wall_thickness = 2,
|
||||
noisy_factor = 2
|
||||
);
|
@@ -1,5 +1,5 @@
|
||||
use <polyline2d.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_hex_walls.scad>;
|
||||
|
||||
columns = 10;
|
||||
@@ -30,11 +30,9 @@ module pyramid_hex_maze(columns, cell_radius, wall_thickness) {
|
||||
|
||||
pyramid_height = square_w / sqrt(2);
|
||||
|
||||
blocks = mz_square_blocks(
|
||||
rows, columns
|
||||
);
|
||||
cells = mz_square_cells(rows, columns);
|
||||
|
||||
walls = mz_hex_walls(blocks, rows, columns, cell_radius, wall_thickness);
|
||||
walls = mz_hex_walls(cells, rows, columns, cell_radius, wall_thickness);
|
||||
|
||||
intersection() {
|
||||
linear_extrude(pyramid_height)
|
||||
|
@@ -1,26 +1,26 @@
|
||||
use <square_maze.scad>;
|
||||
|
||||
maze_rows = 10;
|
||||
block_width = 2;
|
||||
cell_width = 2;
|
||||
wall_thickness = 1;
|
||||
|
||||
module pyramid_maze(maze_rows, block_width, wall_thickness) {
|
||||
module pyramid_maze(maze_rows, cell_width, wall_thickness) {
|
||||
module pyramid(leng) {
|
||||
height = leng / 1.4142135623730950488016887242097;
|
||||
linear_extrude(height, scale = 0)
|
||||
square(leng, center = true);
|
||||
}
|
||||
|
||||
leng = maze_rows * block_width ;
|
||||
leng = maze_rows * cell_width ;
|
||||
half_leng = leng / 2;
|
||||
|
||||
intersection() {
|
||||
linear_extrude(leng * 2)
|
||||
translate([-half_leng, -half_leng])
|
||||
square_maze(maze_rows, block_width, wall_thickness);
|
||||
square_maze(maze_rows, cell_width, wall_thickness);
|
||||
|
||||
pyramid(leng + wall_thickness);
|
||||
}
|
||||
}
|
||||
|
||||
pyramid_maze(maze_rows, block_width, wall_thickness);
|
||||
pyramid_maze(maze_rows, cell_width, wall_thickness);
|
@@ -1,6 +1,6 @@
|
||||
use <line2d.scad>;
|
||||
use <hollow_out.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_get.scad>;
|
||||
|
||||
// only for creating a small maze
|
||||
@@ -8,7 +8,7 @@ use <maze/mz_square_get.scad>;
|
||||
radius_of_circle_wrapper = 15;
|
||||
wall_thickness = 1;
|
||||
wall_height = 1;
|
||||
cblocks = 6;
|
||||
ccells = 6;
|
||||
levels = 3;
|
||||
sides = 3;
|
||||
|
||||
@@ -36,21 +36,21 @@ module regular_polygon_to_polygon_wall(radius, length, angle, thickness, sides)
|
||||
}
|
||||
}
|
||||
|
||||
module regular_polygon_maze(radius, cblocks, levels, thickness = 1, sides) {
|
||||
function no_wall(block) = get_wall_type(block) == "NO_WALL";
|
||||
function top_wall(block) = get_wall_type(block) == "TOP_WALL";
|
||||
function right_wall(block) = get_wall_type(block) == "RIGHT_WALL";
|
||||
function top_right_wall(block) = get_wall_type(block) == "TOP_RIGHT_WALL";
|
||||
module regular_polygon_maze(radius, ccells, levels, thickness = 1, sides) {
|
||||
function no_wall(cell) = get_wall_type(cell) == "NO_WALL";
|
||||
function top_wall(cell) = get_wall_type(cell) == "TOP_WALL";
|
||||
function right_wall(cell) = get_wall_type(cell) == "RIGHT_WALL";
|
||||
function top_right_wall(cell) = get_wall_type(cell) == "TOP_RIGHT_WALL";
|
||||
|
||||
function get_x(block) = mz_square_get(block, "x");
|
||||
function get_y(block) = mz_square_get(block, "y");
|
||||
function get_wall_type(block) = mz_square_get(block, "w");
|
||||
function get_x(cell) = mz_square_get(cell, "x");
|
||||
function get_y(cell) = mz_square_get(cell, "y");
|
||||
function get_wall_type(cell) = mz_square_get(cell, "w");
|
||||
|
||||
arc_angle = 360 / cblocks;
|
||||
arc_angle = 360 / ccells;
|
||||
r = radius / (levels + 1);
|
||||
|
||||
maze = mz_square_blocks(
|
||||
cblocks, levels, y_wrapping = true
|
||||
maze = mz_square_cells(
|
||||
ccells, levels, y_wrapping = true
|
||||
);
|
||||
|
||||
difference() {
|
||||
@@ -61,13 +61,13 @@ module regular_polygon_maze(radius, cblocks, levels, thickness = 1, sides) {
|
||||
|
||||
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
cell = maze[i];
|
||||
cr = get_x(cell) + 1;
|
||||
cc = get_y(cell);
|
||||
|
||||
angle = cc * arc_angle;
|
||||
|
||||
if(top_wall(block) || top_right_wall(block)) {
|
||||
if(top_wall(cell) || top_right_wall(cell)) {
|
||||
regular_polygon_to_polygon_wall(r * cr, r, cc * arc_angle , thickness, sides);
|
||||
}
|
||||
}
|
||||
@@ -79,11 +79,11 @@ module regular_polygon_maze(radius, cblocks, levels, thickness = 1, sides) {
|
||||
|
||||
// road to the next level
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
cell = maze[i];
|
||||
cr = get_x(cell) + 1;
|
||||
cc = get_y(cell);
|
||||
|
||||
if(no_wall(block) || top_wall(block)) {
|
||||
if(no_wall(cell) || top_wall(cell)) {
|
||||
ring_regular_polygon_sector(r * (cr + 1), (cc + 0.5) * arc_angle , thickness, thickness * 0.75 , sides);
|
||||
}
|
||||
}
|
||||
@@ -92,4 +92,4 @@ module regular_polygon_maze(radius, cblocks, levels, thickness = 1, sides) {
|
||||
}
|
||||
|
||||
linear_extrude(wall_height)
|
||||
regular_polygon_maze(radius_of_circle_wrapper, cblocks, levels, wall_thickness, sides);
|
||||
regular_polygon_maze(radius_of_circle_wrapper, ccells, levels, wall_thickness, sides);
|
||||
|
@@ -1,15 +1,15 @@
|
||||
use <matrix/m_rotation.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <ptf/ptf_sphere.scad>;
|
||||
|
||||
r = 10;
|
||||
rows = 24;
|
||||
columns = 18;
|
||||
block_width = .5;
|
||||
cell_width = .5;
|
||||
wall_thickness = .5;
|
||||
wall_height = 1.5;
|
||||
pole_offset = block_width * 2.5;
|
||||
pole_offset = cell_width * 2.5;
|
||||
|
||||
module sphere_maze() {
|
||||
function _angles(p) =
|
||||
@@ -50,16 +50,16 @@ module sphere_maze() {
|
||||
}
|
||||
|
||||
|
||||
size = [rows * block_width, columns * block_width + pole_offset * 2];
|
||||
blocks = mz_square_blocks(
|
||||
size = [rows * cell_width, columns * cell_width + pole_offset * 2];
|
||||
cells = mz_square_cells(
|
||||
rows, columns,
|
||||
y_wrapping = true
|
||||
);
|
||||
|
||||
p_offset = [block_width * rows, pole_offset, 0];
|
||||
p_offset = [cell_width * rows, pole_offset, 0];
|
||||
mr = m_rotation(90);
|
||||
|
||||
walls = mz_square_walls(blocks, rows, columns, block_width, bottom_border = false);
|
||||
walls = mz_square_walls(cells, rows, columns, cell_width, bottom_border = false);
|
||||
for(wall_pts = walls) {
|
||||
rxpts = [
|
||||
for(p = wall_pts)
|
||||
|
@@ -1,12 +1,12 @@
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
|
||||
module square_maze(rows, block_width, wall_thickness) {
|
||||
blocks = mz_square_blocks(
|
||||
module square_maze(rows, cell_width, wall_thickness) {
|
||||
cells = mz_square_cells(
|
||||
rows, rows
|
||||
);
|
||||
|
||||
walls = mz_square_walls(blocks, rows, rows, block_width);
|
||||
walls = mz_square_walls(cells, rows, rows, cell_width);
|
||||
|
||||
for(wall = walls) {
|
||||
for(i = [0:len(wall) - 2]) {
|
||||
@@ -20,6 +20,6 @@ module square_maze(rows, block_width, wall_thickness) {
|
||||
|
||||
square_maze(
|
||||
rows = 10,
|
||||
block_width = 2,
|
||||
cell_width = 2,
|
||||
wall_thickness = 1
|
||||
);
|
@@ -1,7 +1,7 @@
|
||||
use <square_maze.scad>;
|
||||
|
||||
maze_rows = 8;
|
||||
block_width = 10;
|
||||
cell_width = 10;
|
||||
stairs_width = 5;
|
||||
|
||||
module pyramid_with_stairs(base_width, stairs_width, rows) {
|
||||
@@ -29,29 +29,29 @@ module pyramid_with_stairs(base_width, stairs_width, rows) {
|
||||
}
|
||||
}
|
||||
|
||||
module step_pyramid_maze(maze_rows, block_width, stairs_width) {
|
||||
module step_pyramid_maze(maze_rows, cell_width, stairs_width) {
|
||||
intersection() {
|
||||
pyramid_with_stairs(
|
||||
maze_rows * block_width, stairs_width, maze_rows);
|
||||
maze_rows * cell_width, stairs_width, maze_rows);
|
||||
|
||||
linear_extrude(maze_rows * block_width * sqrt(2) / 2) difference() {
|
||||
linear_extrude(maze_rows * cell_width * sqrt(2) / 2) difference() {
|
||||
|
||||
square([block_width * maze_rows + stairs_width, block_width * maze_rows + stairs_width], center = true);
|
||||
square([cell_width * maze_rows + stairs_width, cell_width * maze_rows + stairs_width], center = true);
|
||||
|
||||
translate([-(maze_rows * block_width) / 2, -(maze_rows * block_width) / 2, 0])
|
||||
translate([-(maze_rows * cell_width) / 2, -(maze_rows * cell_width) / 2, 0])
|
||||
difference() {
|
||||
square_maze(maze_rows, block_width, stairs_width);
|
||||
square_maze(maze_rows, cell_width, stairs_width);
|
||||
|
||||
// entry
|
||||
translate([0, stairs_width])
|
||||
square(stairs_width, center = true);
|
||||
|
||||
// exit
|
||||
translate([maze_rows * block_width, maze_rows * block_width - stairs_width])
|
||||
translate([maze_rows * cell_width, maze_rows * cell_width - stairs_width])
|
||||
square(stairs_width, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
step_pyramid_maze(maze_rows, block_width, stairs_width);
|
||||
step_pyramid_maze(maze_rows, cell_width, stairs_width);
|
@@ -1,6 +1,6 @@
|
||||
use <polyline2d.scad>;
|
||||
use <stereographic_extrude.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_hex_walls.scad>;
|
||||
|
||||
columns = 10;
|
||||
@@ -24,11 +24,11 @@ module hex_maze_stereographic_projection(columns, cell_radius, wall_thickness, f
|
||||
pyramid_height = square_w / sqrt(2);
|
||||
|
||||
// create a maze
|
||||
blocks = mz_square_blocks(
|
||||
cells = mz_square_cells(
|
||||
rows, columns
|
||||
);
|
||||
|
||||
walls = mz_hex_walls(blocks, rows, columns, cell_radius, wall_thickness);
|
||||
walls = mz_hex_walls(cells, rows, columns, cell_radius, wall_thickness);
|
||||
|
||||
stereographic_extrude(square_w, $fn = fn)
|
||||
translate([grid_w - square_w / 2, grid_h - square_w / 2, 0])
|
||||
|
@@ -2,18 +2,18 @@ use <stereographic_extrude.scad>;
|
||||
use <square_maze.scad>;
|
||||
|
||||
maze_rows = 10;
|
||||
block_width = 40;
|
||||
cell_width = 40;
|
||||
wall_thickness = 20;
|
||||
fn = 24;
|
||||
shadow = "YES"; // [YES, NO]
|
||||
wall_height = 2;
|
||||
|
||||
module stereographic_projection_maze2(maze_rows, block_width, wall_thickness, fn, wall_height, shadow) {
|
||||
length = block_width * maze_rows + wall_thickness;
|
||||
module stereographic_projection_maze2(maze_rows, cell_width, wall_thickness, fn, wall_height, shadow) {
|
||||
length = cell_width * maze_rows + wall_thickness;
|
||||
|
||||
module maze() {
|
||||
translate([-block_width * maze_rows / 2, -block_width * maze_rows / 2, 0])
|
||||
square_maze(maze_rows, block_width, wall_thickness);
|
||||
translate([-cell_width * maze_rows / 2, -cell_width * maze_rows / 2, 0])
|
||||
square_maze(maze_rows, cell_width, wall_thickness);
|
||||
}
|
||||
|
||||
stereographic_extrude(shadow_side_leng = length, $fn = fn)
|
||||
@@ -26,4 +26,4 @@ module stereographic_projection_maze2(maze_rows, block_width, wall_thickness, fn
|
||||
}
|
||||
}
|
||||
|
||||
stereographic_projection_maze2(maze_rows, block_width, wall_thickness, fn, wall_height, shadow);
|
||||
stereographic_projection_maze2(maze_rows, cell_width, wall_thickness, fn, wall_height, shadow);
|
@@ -1,27 +1,27 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <ptf/ptf_torus.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
|
||||
rows = 36;
|
||||
columns = 12;
|
||||
block_width = 2;
|
||||
cell_width = 2;
|
||||
wall_thickness = 1;
|
||||
angle = 180;
|
||||
twist = 360;
|
||||
|
||||
leng = rows * block_width;
|
||||
leng = rows * cell_width;
|
||||
radius = 0.5 * leng / PI;
|
||||
a_step = 360 / leng;
|
||||
|
||||
blocks = mz_square_blocks(
|
||||
cells = mz_square_cells(
|
||||
rows, columns,
|
||||
x_wrapping = true, y_wrapping = true
|
||||
);
|
||||
|
||||
walls = mz_square_walls(blocks, rows, columns, block_width, left_border = false, bottom_border = false);
|
||||
walls = mz_square_walls(cells, rows, columns, cell_width, left_border = false, bottom_border = false);
|
||||
|
||||
size = [columns * block_width, rows * block_width];
|
||||
size = [columns * cell_width, rows * cell_width];
|
||||
for(wall_pts = walls) {
|
||||
transformed = [for(pt = wall_pts) ptf_torus(size, pt, [radius, radius / 2], twist = twist)];
|
||||
hull_polyline3d(transformed, wall_thickness, $fn = 4);
|
||||
|
@@ -1,24 +1,24 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <maze/mz_square_blocks.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <ptf/ptf_x_twist.scad>;
|
||||
use <ptf/ptf_y_twist.scad>;
|
||||
|
||||
rows = 10;
|
||||
columns = 10;
|
||||
block_width = 4;
|
||||
cell_width = 4;
|
||||
wall_thickness = 1;
|
||||
angle = 90;
|
||||
axis = "X_AXIS"; // [X_AXIS, Y_AXIS]
|
||||
// $fn = 24;
|
||||
|
||||
blocks = mz_square_blocks(
|
||||
cells = mz_square_cells(
|
||||
rows, columns
|
||||
);
|
||||
|
||||
walls = mz_square_walls(blocks, rows, columns, block_width);
|
||||
walls = mz_square_walls(cells, rows, columns, cell_width);
|
||||
|
||||
size = [columns * block_width, rows * block_width];
|
||||
size = [columns * cell_width, rows * cell_width];
|
||||
for(wall_pts = walls) {
|
||||
transformed = [for(pt = wall_pts) axis == "X_AXIS" ? ptf_x_twist(size, pt, angle) : ptf_y_twist(size, pt, angle)];
|
||||
hull_polyline3d(transformed, wall_thickness);
|
||||
|
Reference in New Issue
Block a user