triangle2square.scad
1 // https://www.cs.purdue.edu/homes/gnf/book2/trisqu.html 2 function triangle2square(tri_side_leng) = 3 let( 4 p0 = [0, 0], 5 p1 = tri_side_leng * [0.25, 0.4330125], 6 p2 = tri_side_leng * [0.5, 0.8660255], 7 p4 = tri_side_leng * [1, 0], 8 p3 = tri_side_leng * [0.75, 0.4330125], 9 p6 = tri_side_leng * [0.254508, 0], 10 p5 = tri_side_leng * [0.754508, 0], 11 p8 = tri_side_leng * [0.5380015, 0.247745], 12 p7 = tri_side_leng * [0.4665065, 0.1852665], 13 pieces = [ 14 [p0, p6, p7, p1], 15 [p6, p5, p8], 16 [p5, p4, p3, p8], 17 [p1, p7, p3, p2] 18 ], 19 hinged_pts = [p5, p3, p1] 20 ) 21 [pieces, hinged_pts];