2022-06-06 13:11:46 +08:00
|
|
|
use <ptf/ptf_rotate.scad>
|
|
|
|
use <polyline_join.scad>
|
|
|
|
use <shape_superformula.scad>
|
2021-08-08 14:57:52 +08:00
|
|
|
|
|
|
|
function shape2wire(shape, r) =
|
|
|
|
let(
|
|
|
|
leng_shape = len(shape),
|
|
|
|
a = 360 / leng_shape
|
|
|
|
)
|
|
|
|
[
|
|
|
|
for(i = [0:len(shape) - 1])
|
|
|
|
let(p = shape[i])
|
|
|
|
ptf_rotate(
|
|
|
|
ptf_rotate([p[0], p[1], 0], [90, 0, 0]) + [r, 0, 0],
|
|
|
|
a * i
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
phi_step = 0.05;
|
|
|
|
m = 16;
|
|
|
|
n = 0.5;
|
|
|
|
n3 = 16;
|
|
|
|
shape = shape_superformula(phi_step, m, m, n, n, n3) * 30;
|
|
|
|
|
|
|
|
translate([150, 0])
|
|
|
|
rotate([90, 0, 0])
|
|
|
|
linear_extrude(1, center = true)
|
|
|
|
difference() {
|
|
|
|
square(120, center = true);
|
2022-02-28 10:52:47 +08:00
|
|
|
polyline_join([each shape, shape[0]])
|
2021-10-08 09:36:01 +08:00
|
|
|
circle(2.5);
|
2021-08-08 14:57:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
wire = shape2wire(shape, 150);
|
|
|
|
rotate(-$t * 360)
|
2022-02-28 10:52:47 +08:00
|
|
|
polyline_join([each wire, wire[0]])
|
2021-10-08 09:36:01 +08:00
|
|
|
sphere(1.5);
|