1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-18 06:38:14 +01:00

accept 2D offset

This commit is contained in:
Justin Lin 2020-03-11 10:13:32 +08:00
parent 4316b5dc61
commit a8bed95fb6
2 changed files with 4 additions and 3 deletions

View File

@ -13,7 +13,8 @@ module circle_maze(start, r_blocks, block_width, wall_thickness, origin_offset)
width = double_r_blocks * block_width;
walls = mz_walls(blocks, double_r_blocks, double_r_blocks, block_width);
offset = is_undef(origin_offset) ? width / 2 : origin_offset;
half_width = width / 2;
offset = is_undef(origin_offset) ? [half_width, half_width] : origin_offset;
for(wall = walls) {
for(i = [0:len(wall) - 2]) {
@ -26,7 +27,7 @@ module circle_maze(start, r_blocks, block_width, wall_thickness, origin_offset)
circle_maze(
start = [1, 1],
r_blocks = 10,
r_blocks = 5,
block_width = 2,
wall_thickness = .75
);

View File

@ -1,6 +1,6 @@
function ptf_circle(point, offset) =
let(
p = [point[0] - offset, point[1] - offset],
p = [point[0] - offset[1], point[1] - offset[0]],
n = max(abs(p[0]), abs(p[1])),
r = n * 1.414,
a = atan2(p[0], p[1])