1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-11 09:14:29 +02:00
This commit is contained in:
Justin Lin
2021-09-03 11:38:21 +08:00
parent 346cea1db8
commit 853da1f9e2
2 changed files with 19 additions and 19 deletions

View File

@@ -7,19 +7,19 @@ module r_union2(radius = 1) {
rx = is_list(r) ? r[1] : r; rx = is_list(r) ? r[1] : r;
ry = is_list(r) ? r[0] : r; ry = is_list(r) ? r[0] : r;
for(i = [0:fn - 1]) { for(a = [0:step:step * (fn - 1)]) {
x = rx - sin(i * step) * rx;
y = ry - cos(i * step) * ry;
xi = rx - sin(i * step + step) * rx;
yi = ry - cos(i * step + step) * ry;
hull() { hull() {
intersection() { intersection() {
offset(x) children(0); offset(rx - sin(a) * rx)
offset(y) children(1); children(0);
offset(ry - cos(a) * ry)
children(1);
} }
intersection() { intersection() {
offset(xi) children(0); offset(rx - sin(a + step) * rx)
offset(yi) children(1); children(0);
offset(ry - cos(a + step) * ry)
children(1);
} }
} }
} }

View File

@@ -13,20 +13,20 @@ module r_union3(radius = 1) {
step = 90 / fn; step = 90 / fn;
rx = is_list(r) ? r[1] : r; rx = is_list(r) ? r[1] : r;
ry = is_list(r) ? r[0] : r; ry = is_list(r) ? r[0] : r;
for(i = [0:fn - 1]) { for(a = [0:step:step * (fn - 1)]) {
x = rx - sin(i * step) * rx;
y = ry - cos(i * step) * ry;
xi = rx - sin(i * step + step) * rx;
yi = ry - cos(i * step + step) * ry;
hull() { hull() {
intersection() { intersection() {
dilate(x) children(0); dilate(rx - sin(a) * rx)
dilate(y) children(1); children(0);
dilate(ry - cos(a) * ry)
children(1);
} }
intersection() { intersection() {
dilate(xi) children(0); dilate(rx - sin(a + step) * rx)
dilate(yi) children(1); children(0);
dilate(ry - cos(a + step) * ry)
children(1);
} }
} }
} }