1
0
mirror of https://github.com/nophead/NopSCADlib.git synced 2025-08-21 14:51:22 +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

@@ -38,12 +38,12 @@ module teardrop(h, r, center = true, truncate = true, chamfer = 0, chamfer_both_
circle4n(R);
if (teardrop_angle > 0) {
x = sin(teardrop_angle) - (1 - cos(teardrop_angle)) / tan(teardrop_angle);
x = R * tan(teardrop_angle / 2);
if(truncate)
translate([0, R / 2])
square([2 * R * x, R], center = true);
square([2 * x, R], center = true);
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])