cube([size[0], size[1], tile_th]);
}
-module RoundEdge(left_post, right_post) {
- length_vec = right_post - left_post;
+m4_dnl INREFFRAME(left_post, right_post, morevars) { body; }
+m4_define(`INREFFRAME',`
+ length_vec = ($2) - ($1);
length = dist2d([0,0], length_vec);
length_uvec = length_vec / length;
ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
- m = [ [ length_uvec[0], ortho_uvec[0], 0, left_post[0], ],
- [ length_uvec[1], ortho_uvec[1], 0, left_post[1], ],
+ m = [ [ length_uvec[0], ortho_uvec[0], 0, ($1)[0], ],
+ [ length_uvec[1], ortho_uvec[1], 0, ($1)[1], ],
[ 0, 0, 1, 0, ],
[ 0, 0, 0, 1, ] ];
- tlength = length + thehd[1] * 2;
- multmatrix(m) {
- translate([-thehd[1], -thehd[0], -round_edge_rad]){
- difference(){
- rotate([0,90,0])
- cylinder(r= round_edge_rad, h= tlength, $fn=50);
- translate([-1, 0, -20])
- cube([tlength+2, 20, 20]);
- }
+ $3
+ multmatrix(m)
+ translate([-thehd[1], -thehd[0], -round_edge_rad])
+')
+
+module RoundEdge(left_post, right_post) {
+ INREFFRAME(left_post, right_post,
+ `tlength = length + thehd[1] * 2;') { m4_dnl '
+ difference(){
+ rotate([0,90,0])
+ cylinder(r= round_edge_rad, h= tlength, $fn=50);
+ translate([-1, 0, -20])
+ cube([tlength+2, 20, 20]);
}
}
}
module RoundLeftCorner(this_post, right_post) {
- length_vec = right_post - this_post;
- length_uvec = length_vec - dist2d([0,0], length_vec);
- ortho_uvec = [ -length_uvec[1], length_uvec[0] ];
- m = [ [ length_uvec[0], ortho_uvec[0], 0, this_post[0], ],
- [ length_uvec[1], ortho_uvec[1], 0, this_post[1], ],
- [ 0, 0, 1, 0, ],
- [ 0, 0, 0, 1, ] ];
- multmatrix(m) {
- translate([-thehd[1], -thehd[0], -round_edge_rad]){
- difference(){
- sphere(r= round_edge_rad, $fn=60);
- translate([0,0, -20])
- cube([20,20,20]);
- }
+ INREFFRAME(this_post, right_post){
+ difference(){
+ sphere(r= round_edge_rad, $fn=60);
+ translate([0,0, -20])
+ cube([20,20,20]);
}
}
}