mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 09:14:29 +02:00
refactor
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user