add to xBar, also refactor

This commit is contained in:
zhao
2023-01-13 00:58:46 -05:00
parent 933b2d9d73
commit ba1dc567b7
9 changed files with 204 additions and 32 deletions

View File

@ -5,10 +5,7 @@ include <./common.scad>
module halfspace(vpos, p) {
translate(p)
align(a=[0,0,1], b=vpos)
align(a=[0,0,-1], b=vpos)
translate(v=[0,0,-inf/2])
cube(size=[inf, inf, inf], center=true);
}
halfspace(vpos=[1,1,1], p=[10,10,10]);
}

View File

@ -13,9 +13,20 @@ function mirror4XY(midpoint, offsetX, offsetY) =
module align(a,b) {
echo("a", a);
echo("b", b);
rot_axis = cross(a,b);
angle = acos(a*b/ (norm(a)*norm(b)));
if (rot_axis == 0) {
error("Can't align - provided vectors are parallel");
}
echo("rot_axis", rot_axis);
angle = acos(a*b/(norm(a)*norm(b)));
echo("angle", angle)
rotate(v=rot_axis, a=angle)
children(0);
}
}