mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-16 19:54:29 +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]);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// 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