1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-21 22:55:26 +02:00

Simplified teardrop top length calculation.

This commit is contained in:
Chris Palmer
2021-12-14 21:22:29 +00:00
parent 7f8dfb9e73
commit 608f0b2db0

View File

@@ -34,18 +34,18 @@ module teardrop(h, r, center = true, truncate = true, chamfer = 0, chamfer_both_
mirror([side, 0, 0]) mirror([side, 0, 0])
intersection() { intersection() {
hull() hull()
translate([offset, 0]) { translate([offset, 0]) {
circle4n(R); circle4n(R);
if (teardrop_angle > 0) { if (teardrop_angle > 0) {
x = sin(teardrop_angle) - (1 - cos(teardrop_angle)) / tan(teardrop_angle); x = R * tan(teardrop_angle / 2);
if(truncate) if(truncate)
translate([0, R / 2]) translate([0, R / 2])
square([2 * R * x, R], center = true); square([2 * x, R], center = true);
else else
polygon([[0, 0], [eps, 0], [0, R * (1 + x * tan(min(teardrop_angle, 90 - eps)))]]); polygon([[0, 0], [eps, 0], [0, R + x * tan(min(teardrop_angle, 90 - eps))]]);
}
} }
}
translate([0, -2 * R]) translate([0, -2 * R])
square([R, 4 * R]); square([R, 4 * R]);
} }