mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-22 06:13:10 +02:00
use polyline_join
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <ptf/ptf_ring.scad>;
|
||||
@@ -24,5 +24,6 @@ walls = mz_square_walls(cells, rows, columns, cell_width, bottom_border = false)
|
||||
size = [columns * cell_width, rows * cell_width];
|
||||
for(wall_pts = walls) {
|
||||
transformed = [for(pt = wall_pts) ptf_ring(size, pt, radius, 360, angle)];
|
||||
hull_polyline3d(transformed, line_diameter);
|
||||
polyline_join(transformed)
|
||||
sphere(d = line_diameter);
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <util/rand.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
@@ -18,7 +18,7 @@ module noisy_circle_maze(r_cells, cell_width, wall_thickness, origin_offset, noi
|
||||
rect_size = is_undef(origin_offset) ? [width, width] : [width, width] - origin_offset * 2;
|
||||
|
||||
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]) {
|
||||
@@ -28,7 +28,8 @@ module noisy_circle_maze(r_cells, cell_width, wall_thickness, origin_offset, noi
|
||||
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;
|
||||
hull_polyline2d([p0 + [pn00, pn01], p1 + [pn10, pn11]], width = wall_thickness);
|
||||
polyline_join([p0 + [pn00, pn01], p1 + [pn10, pn11]])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
use <archimedean_spiral.scad>;
|
||||
use <hull_polyline3d.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
@@ -29,8 +28,10 @@ module spiral_maze() {
|
||||
rows, columns, cell_width
|
||||
);
|
||||
|
||||
half_thickness = wall_thickness / 2;
|
||||
|
||||
for(wall = walls) {
|
||||
hull_polyline3d([
|
||||
polyline_join([
|
||||
for(p = wall)
|
||||
let(
|
||||
x = p[0],
|
||||
@@ -38,14 +39,12 @@ module spiral_maze() {
|
||||
cp = (pts3d[x] + pts3d[x + 1]) / 2
|
||||
)
|
||||
cp + [0, y, 0]
|
||||
],
|
||||
wall_thickness,
|
||||
$fn = 5
|
||||
);
|
||||
]) sphere(half_thickness, $fn = 5);
|
||||
}
|
||||
|
||||
translate([0, rows, 0])
|
||||
rotate([90, 0, 0])
|
||||
linear_extrude(rows)
|
||||
hull_polyline2d([for(i = [1:len(pts2d) - 2]) pts2d[i]], wall_thickness / 2);
|
||||
polyline_join([for(i = [1:len(pts2d) - 2]) pts2d[i]])
|
||||
circle(wall_thickness / 4);
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
use <maze/mz_theta_cells.scad>;
|
||||
use <maze/mz_theta_get.scad>;
|
||||
use <hull_polyline2d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
|
||||
rows = 5;
|
||||
beginning_number = 8;
|
||||
@@ -16,6 +16,7 @@ module theta_maze(rows, beginning_number, cell_width, wall_thickness, wall_heigh
|
||||
|
||||
maze = mz_theta_cells(rows, beginning_number);
|
||||
|
||||
half_wall_thickness = wall_thickness / 2;
|
||||
linear_extrude(wall_height) {
|
||||
for(rows = maze) {
|
||||
for(cell = rows) {
|
||||
@@ -33,11 +34,13 @@ module theta_maze(rows, beginning_number, cell_width, wall_thickness, wall_heigh
|
||||
outerVt2 = vt_from_angle(theta2, outerR);
|
||||
|
||||
if(wallType == "INWARD_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
hull_polyline2d([innerVt1, innerVt2], width = wall_thickness);
|
||||
polyline_join([innerVt1, innerVt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
|
||||
if(wallType == "CCW_WALL" || wallType == "INWARD_CCW_WALL") {
|
||||
hull_polyline2d([innerVt2, outerVt2], width = wall_thickness);
|
||||
polyline_join([innerVt2, outerVt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +50,8 @@ module theta_maze(rows, beginning_number, cell_width, wall_thickness, wall_heigh
|
||||
for(theta = [0:thetaStep:360 - thetaStep]) {
|
||||
vt1 = vt_from_angle(theta, r);
|
||||
vt2 = vt_from_angle(theta + thetaStep, r);
|
||||
hull_polyline2d([vt1, vt2], width = wall_thickness);
|
||||
polyline_join([vt1, vt2])
|
||||
circle(half_wall_thickness);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <path_extrude.scad>;
|
||||
@@ -42,25 +42,22 @@ module torus_knot_maze() {
|
||||
);
|
||||
|
||||
half_row = rows / 2;
|
||||
|
||||
r = wall_thickness / 2;
|
||||
for(wall = walls) {
|
||||
hull_polyline3d([
|
||||
for(p = wall)
|
||||
let(
|
||||
x = p[0],
|
||||
y = p[1]
|
||||
)
|
||||
path[x] + ptf_rotate(
|
||||
ptf_rotate(
|
||||
[-y + half_row, 0, 0],
|
||||
[0, 0, -90]
|
||||
),
|
||||
[0, angle_yz[x][0], angle_yz[x][1]]
|
||||
)
|
||||
],
|
||||
wall_thickness,
|
||||
$fn = 4
|
||||
);
|
||||
polyline_join([
|
||||
for(p = wall)
|
||||
let(
|
||||
x = p[0],
|
||||
y = p[1]
|
||||
)
|
||||
path[x] + ptf_rotate(
|
||||
ptf_rotate(
|
||||
[-y + half_row, 0, 0],
|
||||
[0, 0, -90]
|
||||
),
|
||||
[0, angle_yz[x][0], angle_yz[x][1]]
|
||||
)
|
||||
]) sphere(r, $fn = 4);
|
||||
}
|
||||
|
||||
if(filled) {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <ptf/ptf_torus.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
@@ -24,7 +24,8 @@ walls = mz_square_walls(cells, rows, columns, cell_width, left_border = false, b
|
||||
size = [columns * cell_width, rows * cell_width];
|
||||
for(wall_pts = walls) {
|
||||
transformed = [for(pt = wall_pts) ptf_torus(size, pt, [radius, radius / 2], twist = twist)];
|
||||
hull_polyline3d(transformed, line_diameter, $fn = 4);
|
||||
polyline_join(transformed)
|
||||
sphere(d = line_diameter, $fn = 4);
|
||||
}
|
||||
|
||||
color("black")
|
||||
|
@@ -1,4 +1,4 @@
|
||||
use <hull_polyline3d.scad>;
|
||||
use <polyline_join.scad>;
|
||||
use <maze/mz_square_cells.scad>;
|
||||
use <maze/mz_square_walls.scad>;
|
||||
use <ptf/ptf_x_twist.scad>;
|
||||
@@ -21,5 +21,6 @@ walls = mz_square_walls(cells, rows, columns, cell_width);
|
||||
size = [columns * cell_width, rows * cell_width];
|
||||
for(wall_pts = walls) {
|
||||
transformed = [for(pt = wall_pts) axis == "X_AXIS" ? ptf_x_twist(size, pt, angle) : ptf_y_twist(size, pt, angle)];
|
||||
hull_polyline3d(transformed, line_diameter);
|
||||
polyline_join(transformed)
|
||||
sphere(d = line_diameter);
|
||||
}
|
Reference in New Issue
Block a user