mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-29 09:19:59 +02:00
change to 0-based
This commit is contained in:
@@ -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([1, 1], maze_rows, block_width, wall_thickness);
|
||||
square_maze(maze_rows, block_width, wall_thickness);
|
||||
}
|
||||
|
||||
one_maze();
|
||||
|
@@ -60,9 +60,9 @@ 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 upper_wall(block) = get_wall_type(block) == "UPPER_WALL";
|
||||
function top_wall(block) = get_wall_type(block) == "TOP_WALL";
|
||||
function right_wall(block) = get_wall_type(block) == "RIGHT_WALL";
|
||||
function upper_right_wall(block) = get_wall_type(block) == "UPPER_RIGHT_WALL";
|
||||
function top_right_wall(block) = get_wall_type(block) == "TOP_RIGHT_WALL";
|
||||
|
||||
function get_x(block) = mz_square_get(block, "x");
|
||||
function get_y(block) = mz_square_get(block, "y");
|
||||
@@ -80,12 +80,12 @@ module heart_maze(maze, radius, cblocks, levels, thickness = 1) {
|
||||
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block);
|
||||
cc = get_y(block) - 1;
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
|
||||
angle = cc * arc_angle;
|
||||
|
||||
if(upper_wall(block) || upper_right_wall(block)) {
|
||||
if(top_wall(block) || top_right_wall(block)) {
|
||||
heart_to_heart_wall(r * cr, r, cc * arc_angle , thickness);
|
||||
}
|
||||
}
|
||||
@@ -95,10 +95,10 @@ module heart_maze(maze, radius, cblocks, levels, thickness = 1) {
|
||||
// road to the next level
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block);
|
||||
cc = get_y(block) - 1;
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
|
||||
if(no_wall(block) || upper_wall(block)) {
|
||||
if(no_wall(block) || top_wall(block)) {
|
||||
ring_heart_sector(r * (cr + 1), (cc + 0.5) * arc_angle , thickness, thickness * 0.75);
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ use <maze/mz_square_walls.scad>;
|
||||
use <maze/mz_square_initialize.scad>;
|
||||
use <voxel/vx_contour.scad>;
|
||||
|
||||
start = [2, 2];
|
||||
start = [1, 1];
|
||||
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],
|
||||
[0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
|
||||
|
@@ -17,7 +17,7 @@ module pyramid_maze(maze_rows, block_width, wall_thickness) {
|
||||
intersection() {
|
||||
linear_extrude(leng * 2)
|
||||
translate([-half_leng, -half_leng])
|
||||
square_maze([1, 1], maze_rows, block_width, wall_thickness);
|
||||
square_maze(maze_rows, block_width, wall_thickness);
|
||||
|
||||
pyramid(leng + wall_thickness);
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ module random_scala(rows, columns, start, width, height) {
|
||||
random_scala(
|
||||
rows = 2,
|
||||
columns = 3,
|
||||
start = [1, 1],
|
||||
start = [0, 0],
|
||||
width = .5,
|
||||
height = .25
|
||||
);
|
@@ -26,7 +26,7 @@ module ring_regular_polygon_sector(radius, angle, thickness, width, sides) {
|
||||
}
|
||||
|
||||
module regular_polygon_to_polygon_wall(radius, length, angle, thickness, sides) {
|
||||
intersection() {
|
||||
intersection() {
|
||||
difference() {
|
||||
circle(radius + length, $fn = sides);
|
||||
circle(radius, $fn = sides);
|
||||
@@ -38,9 +38,9 @@ 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 upper_wall(block) = get_wall_type(block) == "UPPER_WALL";
|
||||
function top_wall(block) = get_wall_type(block) == "TOP_WALL";
|
||||
function right_wall(block) = get_wall_type(block) == "RIGHT_WALL";
|
||||
function upper_right_wall(block) = get_wall_type(block) == "UPPER_RIGHT_WALL";
|
||||
function top_right_wall(block) = get_wall_type(block) == "TOP_RIGHT_WALL";
|
||||
|
||||
function get_x(block) = mz_square_get(block, "x");
|
||||
function get_y(block) = mz_square_get(block, "y");
|
||||
@@ -62,12 +62,12 @@ module regular_polygon_maze(radius, cblocks, levels, thickness = 1, sides) {
|
||||
|
||||
for(i = [0:len(maze) - 1]) {
|
||||
block = maze[i];
|
||||
cr = get_x(block);
|
||||
cc = get_y(block) - 1;
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
|
||||
angle = cc * arc_angle;
|
||||
|
||||
if(upper_wall(block) || upper_right_wall(block)) {
|
||||
if(top_wall(block) || top_right_wall(block)) {
|
||||
regular_polygon_to_polygon_wall(r * cr, r, cc * arc_angle , thickness, sides);
|
||||
}
|
||||
}
|
||||
@@ -80,10 +80,10 @@ 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);
|
||||
cc = get_y(block) - 1;
|
||||
cr = get_x(block) + 1;
|
||||
cc = get_y(block);
|
||||
|
||||
if(no_wall(block) || upper_wall(block)) {
|
||||
if(no_wall(block) || top_wall(block)) {
|
||||
ring_regular_polygon_sector(r * (cr + 1), (cc + 0.5) * arc_angle , thickness, thickness * 0.75 , sides);
|
||||
}
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@ use <maze/mz_hamiltonian.scad>;
|
||||
|
||||
rows = 2;
|
||||
columns = 2;
|
||||
start = [1, 1];
|
||||
start = [0, 0];
|
||||
width = .5;
|
||||
height = .05;
|
||||
test_torii = "FALSE"; // [TRUE, FALSE]
|
||||
|
@@ -40,7 +40,7 @@ module step_pyramid_maze(maze_rows, block_width, stairs_width) {
|
||||
|
||||
translate([-(maze_rows * block_width) / 2, -(maze_rows * block_width) / 2, 0])
|
||||
difference() {
|
||||
square_maze([1, 1], maze_rows, block_width, stairs_width);
|
||||
square_maze(maze_rows, block_width, stairs_width);
|
||||
|
||||
// entry
|
||||
translate([0, stairs_width])
|
||||
|
@@ -13,7 +13,7 @@ module stereographic_projection_maze2(maze_rows, block_width, wall_thickness, fn
|
||||
|
||||
module maze() {
|
||||
translate([-block_width * maze_rows / 2, -block_width * maze_rows / 2, 0])
|
||||
square_maze([1, 1], maze_rows, block_width, wall_thickness);
|
||||
square_maze(maze_rows, block_width, wall_thickness);
|
||||
}
|
||||
|
||||
stereographic_extrude(shadow_side_leng = length, $fn = fn)
|
||||
|
Reference in New Issue
Block a user