1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-16 11:44:50 +02:00

use polyline_join

This commit is contained in:
Justin Lin
2021-10-08 09:36:01 +08:00
parent e9440e55d6
commit a14c5676d4
36 changed files with 158 additions and 136 deletions

View File

@@ -1,5 +1,5 @@
use <shape_circle.scad>;
use <hull_polyline2d.scad>;
use <polyline_join.scad>;
use <util/sum.scad>;
beginning_radius = 10;
@@ -18,11 +18,14 @@ module spiral_polygons(beginning_radius, line_width, fn, n) {
dr = y / cos(theta);
pw = pow((beginning_radius + dr) * sin(theta), 2);
half_line_width = line_width / 2;
function a(ri, ro, i) = acos((pow(ro, 2) + pow(ri, 2) - pw * pow(0.985, i)) / (2 * ro * ri));
module drawPolygon(r) {
pts = shape_circle(radius = r, $fn = fn);
hull_polyline2d(concat(pts, [pts[0]]), width = line_width, $fn = 12);
polyline_join(concat(pts, [pts[0]]))
circle(half_line_width, $fn = 12);
}
rs = [for(i = [0: n - 1]) beginning_radius + i * dr];

View File

@@ -1,4 +1,4 @@
use <hull_polyline3d.scad>;
use <polyline_join.scad>;
length = 100;
diff_scale = 0.125;
@@ -22,7 +22,8 @@ module square_pursuit_3d(length, diff_scale, diameter, n) {
npts = [for(i = [0:3]) inter_p(pts[i], pts[(i + 1) % 4], leng, d)];
hull_polyline3d(concat(npts, [npts[3], npts[0]]), diameter);
polyline_join(concat(npts, [npts[3], npts[0]]))
sphere(d = diameter);
_square_pursuit_3d(npts, diff_scale, diameter, n - 1);
}
@@ -36,7 +37,8 @@ module square_pursuit_3d(length, diff_scale, diameter, n) {
[0, length, 0]
];
hull_polyline3d(concat(pts, [pts[3], pts[0]]), diameter);
polyline_join(concat(pts, [pts[3], pts[0]]))
sphere(d = diameter);
_square_pursuit_3d(pts, diff_scale, diameter, n - 1);
}