1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-31 18:22:08 +02:00

change to 0-based

This commit is contained in:
Justin Lin
2020-12-19 11:14:47 +08:00
parent 931c388ad2
commit fcf2cc1511
16 changed files with 48 additions and 59 deletions

View File

@@ -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);
}
}