diff --git a/src/line2d.scad b/src/line2d.scad index c6782caa..3f712b30 100644 --- a/src/line2d.scad +++ b/src/line2d.scad @@ -19,11 +19,6 @@ module line2d(p1, p2, width, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") { atan_angle = atan2(p2[1] - p1[1], p2[0] - p1[0]); leng = sqrt(pow(p2[0] - p1[0], 2) + pow(p2[1] - p1[1], 2)); - translate(p1) - rotate(atan_angle) - translate([0, -width / 2]) - square([leng, width]); - frags = __nearest_multiple_of_4(__frags(half_width)); module square_end(point) { @@ -43,10 +38,22 @@ module line2d(p1, p2, width, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") { } else if(p1Style == "CAP_ROUND") { round_end(p1); } + + translate(p1) + rotate(atan_angle) + translate([0, -width / 2]) + square([leng, width]); if(p2Style == "CAP_SQUARE") { square_end(p2); } else if(p2Style == "CAP_ROUND") { round_end(p2); } -} \ No newline at end of file + + // hook for testing + test_line2d_line(atan_angle, leng, width, frags); +} + +module test_line2d_line(angle, length, width, frags) { + echo(angle, length, width, frags); +}