diff --git a/servos.scad b/servos.scad index afdea35..b751835 100644 --- a/servos.scad +++ b/servos.scad @@ -104,4 +104,5 @@ module alignds420(position, rotation, screws = 0, axle_lenght = 0) } } +// Tests: module test_alignds420(){alignds420(screws=1);} diff --git a/triangles.scad b/triangles.scad index f40ea30..2482d06 100644 --- a/triangles.scad +++ b/triangles.scad @@ -24,7 +24,41 @@ module triangle(o_len, a_len, depth) } } +/** + * Standard right-angled triangle (tangent version) + * + * @param number angle of adjacent to hypotenuse (ie tangent) + * @param number a_len Lenght of the adjacent side + * @param number depth How wide/deep the triangle is in the 3rd dimension + */ +module a_triangle(tan_angle, a_len, depth) +{ + linear_extrude(height=depth) + { + polygon(points=[[0,0],[a_len,0],[0,tan(tan_angle) * a_len]], paths=[[0,1,2]]); + } +} // Tests: -module test_triangle(){triangle(5,10,7);} +module test_triangle() { triangle(5, 5, 5); } +module test_a_triangle() { a_triangle(45, 5, 5); } +module test_triangles() +{ + // Generate a bunch of triangles by sizes + for (i = [1:10]) + { + translate([i*7, -30, i*7]) + { + triangle(i*5, sqrt(i*5+pow(i,2)), 5); + } + } + // Generate a bunch of triangles by angle + for (i = [1:85/5]) + { + translate([i*7, 20, i*7]) + { + a_triangle(i*5, 10, 5); + } + } +}