add halfspace
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
$fn=64;
|
||||
|
||||
// TODO move these to math
|
||||
eps=0.0001;
|
||||
|
||||
inf10 = 10;
|
||||
|
||||
@ -1,2 +1,14 @@
|
||||
// TODO
|
||||
// probably want to get rotations first
|
||||
|
||||
// Wake up sheeple. Halfspaces are just really BIG cubes!
|
||||
include <./math.scad>
|
||||
include <./common.scad>
|
||||
|
||||
module halfspace(vpos, p) {
|
||||
translate(p)
|
||||
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]);
|
||||
@ -10,3 +10,12 @@ function mirror4XY(midpoint, offsetX, offsetY) =
|
||||
[midpoint[0]-offsetX, midpoint[1]+offsetY, midpoint[2]],
|
||||
[midpoint[0]-offsetX, midpoint[1]-offsetY, midpoint[2]],
|
||||
[midpoint[0]+offsetX, midpoint[1]-offsetY, midpoint[2]]];
|
||||
|
||||
|
||||
module align(a,b) {
|
||||
rot_axis = cross(a,b);
|
||||
angle = acos(a*b/ (norm(a)*norm(b)));
|
||||
|
||||
rotate(v=rot_axis, a=angle)
|
||||
children(0);
|
||||
}
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
// TODO
|
||||
|
||||
// eg transformation to rotate vector a to vector b, etc
|
||||
Reference in New Issue
Block a user