1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-21 05:52:16 +02:00

fixed end precision

This commit is contained in:
Justin Lin
2017-04-22 16:29:49 +08:00
parent e0371aa4b7
commit 0e7af027aa

View File

@@ -27,6 +27,13 @@ module line2d(p1, p2, width, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") {
p2 + offset2, p1 + offset2 p2 + offset2, p1 + offset2
]); ]);
frags = $fn > 0 ?
($fn >= 3 ? $fn : 3) :
max(min(360 / $fa, half_width * 2 * 3.14159 / $fs), 5);
remain = frags % 4;
end_frags = (remain / 4) > 0.5 ? frags - remain + 4 : frags - remain;
module square_end(point) { module square_end(point) {
translate(point) translate(point)
rotate(atan_angle) rotate(atan_angle)
@@ -35,7 +42,8 @@ module line2d(p1, p2, width, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") {
module round_end(point) { module round_end(point) {
translate(point) translate(point)
circle(half_width, center = true); rotate(atan_angle)
circle(half_width, center = true, $fn = end_frags);
} }
if(p1Style == "CAP_SQUARE") { if(p1Style == "CAP_SQUARE") {