mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 20:11:50 +02:00
added test hook
This commit is contained in:
@@ -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]);
|
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));
|
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));
|
frags = __nearest_multiple_of_4(__frags(half_width));
|
||||||
|
|
||||||
module square_end(point) {
|
module square_end(point) {
|
||||||
@@ -44,9 +39,21 @@ module line2d(p1, p2, width, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") {
|
|||||||
round_end(p1);
|
round_end(p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
translate(p1)
|
||||||
|
rotate(atan_angle)
|
||||||
|
translate([0, -width / 2])
|
||||||
|
square([leng, width]);
|
||||||
|
|
||||||
if(p2Style == "CAP_SQUARE") {
|
if(p2Style == "CAP_SQUARE") {
|
||||||
square_end(p2);
|
square_end(p2);
|
||||||
} else if(p2Style == "CAP_ROUND") {
|
} else if(p2Style == "CAP_ROUND") {
|
||||||
round_end(p2);
|
round_end(p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hook for testing
|
||||||
|
test_line2d_line(atan_angle, leng, width, frags);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_line2d_line(angle, length, width, frags) {
|
||||||
|
echo(angle, length, width, frags);
|
||||||
}
|
}
|
Reference in New Issue
Block a user