mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-04-16 03:53:35 +02:00
refactor
This commit is contained in:
parent
bfcd168e4b
commit
9fe1994049
@ -1,6 +1,7 @@
|
||||
include <hull_polyline3d.scad>;
|
||||
include <rotate_p.scad>;
|
||||
include <square_maze.scad>;
|
||||
use <twisted_maze.scad>;
|
||||
|
||||
rows = 48;
|
||||
columns = 8;
|
||||
|
@ -351,22 +351,5 @@ function maze_walls(blocks, rows, columns, block_width, left_border = true, bott
|
||||
]
|
||||
, left_walls, buttom_walls
|
||||
);
|
||||
|
||||
function y_twist(walls, angle, rows, columns, block_width) =
|
||||
let(
|
||||
x_offset = columns * block_width / 2,
|
||||
x_centered = [
|
||||
for(wall_pts = walls)
|
||||
[for(pt = wall_pts) [pt[0], pt[1], 0] + [-x_offset, 0, 0]]
|
||||
],
|
||||
a_step = angle / (rows * block_width)
|
||||
)
|
||||
[
|
||||
for(wall_pts = x_centered)
|
||||
[
|
||||
for(pt = wall_pts)
|
||||
rotate_p(pt, [0, pt[1] * a_step, 0]) + [x_offset, 0, 0]
|
||||
]
|
||||
];
|
||||
|
||||
// ==========
|
@ -9,6 +9,23 @@ wall_thickness = 1;
|
||||
angle = 180;
|
||||
// $fn = 24;
|
||||
|
||||
function y_twist(walls, angle, rows, columns, block_width) =
|
||||
let(
|
||||
x_offset = columns * block_width / 2,
|
||||
x_centered = [
|
||||
for(wall_pts = walls)
|
||||
[for(pt = wall_pts) [pt[0], pt[1], 0] + [-x_offset, 0, 0]]
|
||||
],
|
||||
a_step = angle / (rows * block_width)
|
||||
)
|
||||
[
|
||||
for(wall_pts = x_centered)
|
||||
[
|
||||
for(pt = wall_pts)
|
||||
rotate_p(pt, [0, pt[1] * a_step, 0]) + [x_offset, 0, 0]
|
||||
]
|
||||
];
|
||||
|
||||
blocks = go_maze(
|
||||
1, 1, // starting point
|
||||
starting_maze(rows, columns),
|
||||
@ -16,7 +33,6 @@ blocks = go_maze(
|
||||
);
|
||||
|
||||
walls = maze_walls(blocks, rows, columns, block_width);
|
||||
|
||||
for(wall_pts = y_twist(walls, angle, rows, columns, block_width)) {
|
||||
hull_polyline3d(wall_pts, wall_thickness);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user