mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-03-14 11:10:01 +01:00
format
This commit is contained in:
parent
fb4a626707
commit
8ce96f9128
@ -18,17 +18,15 @@ module noisy_circle_maze(r_cells, cell_width, wall_thickness, origin_offset, noi
|
||||
noisy_f = is_undef(noisy_factor) ? 1 : noisy_factor;
|
||||
half_wall_thickness = wall_thickness / 2;
|
||||
seed = rand(0, 256);
|
||||
for(wall = walls) {
|
||||
for(i = [0:len(wall) - 2]) {
|
||||
p0 = ptf_circle(rect_size, wall[i]);
|
||||
p1 = ptf_circle(rect_size, wall[i + 1]);
|
||||
pn00 = nz_perlin2(p0[0], p0[1], seed) * noisy_f;
|
||||
pn01 = nz_perlin2(p0[0] + seed, p0[1] + seed, seed) * noisy_f;
|
||||
pn10 = nz_perlin2(p1[0], p1[1], seed) * noisy_f;
|
||||
pn11 = nz_perlin2(p1[0] + seed, p1[1] + seed, seed) * noisy_f;
|
||||
polyline_join([p0 + [pn00, pn01], p1 + [pn10, pn11]])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
for(wall = walls, i = [0:len(wall) - 2]) {
|
||||
p0 = ptf_circle(rect_size, wall[i]);
|
||||
p1 = ptf_circle(rect_size, wall[i + 1]);
|
||||
pn00 = nz_perlin2(p0[0], p0[1], seed) * noisy_f;
|
||||
pn01 = nz_perlin2(p0[0] + seed, p0[1] + seed, seed) * noisy_f;
|
||||
pn10 = nz_perlin2(p1[0], p1[1], seed) * noisy_f;
|
||||
pn11 = nz_perlin2(p1[0] + seed, p1[1] + seed, seed) * noisy_f;
|
||||
polyline_join([p0 + [pn00, pn01], p1 + [pn10, pn11]])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,9 @@ module pyramid_hex_maze(columns, cell_radius, wall_thickness) {
|
||||
module bottom(rows, columns, cell_radius, wall_thickness) {
|
||||
grid_h = 2 * cell_radius * sin(60);
|
||||
grid_w = cell_radius + cell_radius * cos(60);
|
||||
for(x_cell = [0:columns - 1]) {
|
||||
for(y_cell = [0:rows - 1]) {
|
||||
translate([grid_w * x_cell, grid_h * y_cell + (x_cell % 2 == 0 ? 0 : grid_h / 2), 0])
|
||||
circle(cell_radius + wall_thickness, $fn = 6);
|
||||
}
|
||||
for(x_cell = [0:columns - 1], (y_cell = [0:rows - 1]) {
|
||||
translate([grid_w * x_cell, grid_h * y_cell + (x_cell % 2 == 0 ? 0 : grid_h / 2), 0])
|
||||
circle(cell_radius + wall_thickness, $fn = 6);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,17 +33,17 @@ module pyramid_hex_maze(columns, cell_radius, wall_thickness) {
|
||||
|
||||
intersection() {
|
||||
linear_extrude(pyramid_height)
|
||||
for(wall = walls) {
|
||||
polyline2d(
|
||||
wall,
|
||||
wall_thickness,
|
||||
startingStyle = "CAP_ROUND", endingStyle = "CAP_ROUND"
|
||||
);
|
||||
}
|
||||
for(wall = walls) {
|
||||
polyline2d(
|
||||
wall,
|
||||
wall_thickness,
|
||||
startingStyle = "CAP_ROUND", endingStyle = "CAP_ROUND"
|
||||
);
|
||||
}
|
||||
|
||||
translate([square_offset_x, square_offset_y, 0])
|
||||
linear_extrude(pyramid_height, scale = 0)
|
||||
square([square_w, square_h], center = true);
|
||||
linear_extrude(pyramid_height, scale = 0)
|
||||
square([square_w, square_h], center = true);
|
||||
}
|
||||
|
||||
linear_extrude(wall_thickness)
|
||||
|
@ -52,7 +52,7 @@ module regular_polygon_maze(radius, ccells, levels, thickness = 1, sides) {
|
||||
cells = mz_square(ccells, levels, y_wrapping = true);
|
||||
|
||||
difference() {
|
||||
render() union() {
|
||||
union() {
|
||||
for(i = [1 : levels + 1]) {
|
||||
ring_regular_polygon(r * i, thickness, sides);
|
||||
}
|
||||
@ -70,7 +70,7 @@ module regular_polygon_maze(radius, ccells, levels, thickness = 1, sides) {
|
||||
}
|
||||
}
|
||||
|
||||
render() union() {
|
||||
union() {
|
||||
// maze entry
|
||||
// ring_regular_polygon_sector(r, arc_angle / 1.975 , thickness, r / 3, sides);
|
||||
|
||||
|
@ -44,32 +44,29 @@ module rock_theta_maze(rings, begining_columns, cell_width, rock_size, height_sc
|
||||
scale([1, 1, height_scale])
|
||||
difference() {
|
||||
union() {
|
||||
for(rings = maze) {
|
||||
for(cell = rings) {
|
||||
for(rings = maze, cell = rings) {
|
||||
ri = mz_theta_get(cell, "r");
|
||||
ci = mz_theta_get(cell, "c");
|
||||
if([ri, ci] != [0, 0]) {
|
||||
wallType = 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);
|
||||
|
||||
ri = mz_theta_get(cell, "r");
|
||||
ci = mz_theta_get(cell, "c");
|
||||
if([ri, ci] != [0, 0]) {
|
||||
wallType = 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(wallType == "INWARD_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
rock_wall(innerVt1, innerVt2, rock_size);
|
||||
}
|
||||
|
||||
if(wallType == "CCW_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
rock_wall(innerVt2, outerVt2, rock_size);
|
||||
}
|
||||
innerVt1 = vt_from_angle(theta1, innerR);
|
||||
innerVt2 = vt_from_angle(theta2, innerR);
|
||||
outerVt2 = vt_from_angle(theta2, outerR);
|
||||
|
||||
if(wallType == "INWARD_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
rock_wall(innerVt1, innerVt2, rock_size);
|
||||
}
|
||||
}
|
||||
|
||||
if(wallType == "CCW_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
rock_wall(innerVt2, outerVt2, rock_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
thetaStep = 360 / len(maze[rings - 1]);
|
||||
|
@ -18,31 +18,29 @@ module theta_maze(rings, beginning_number, cell_width, wall_thickness, wall_heig
|
||||
|
||||
half_wall_thickness = wall_thickness / 2;
|
||||
linear_extrude(wall_height) {
|
||||
for(rings = maze) {
|
||||
for(cell = rings) {
|
||||
ri = mz_theta_get(cell, "r");
|
||||
ci = mz_theta_get(cell, "c");
|
||||
wallType = 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(wallType == "INWARD_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
polyline_join([innerVt1, innerVt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
for(rings = maze, cell = rings) {
|
||||
ri = mz_theta_get(cell, "r");
|
||||
ci = mz_theta_get(cell, "c");
|
||||
wallType = 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(wallType == "INWARD_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
polyline_join([innerVt1, innerVt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
|
||||
if(wallType == "CCW_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
polyline_join([innerVt2, outerVt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
}
|
||||
if(wallType == "CCW_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
polyline_join([innerVt2, outerVt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
}
|
||||
|
||||
thetaStep = 360 / len(maze[rings - 1]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user