mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
half space fixes
This commit is contained in:
parent
bf1be88e1b
commit
6e805163ab
2 changed files with 21 additions and 21 deletions
|
@ -147,8 +147,8 @@ module half_of(v=UP, cp, s=1000, planar=false)
|
|||
}
|
||||
}
|
||||
|
||||
function half_of(_arg1=_undef, _arg2=_undef, _arg3=_undef, _arg4=_undef,
|
||||
v=_undef, cp=_undef, p=_undef, s=_undef) =
|
||||
function half_of(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF, _arg4=_UNDEF,
|
||||
v=_UNDEF, cp=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3, _arg4],
|
||||
[[v,undef,0], [cp,0,2], [p,undef,1], [s, 1e4]]),
|
||||
v=args[0], cp0=args[1], p=args[2], s=args[3],
|
||||
|
@ -223,12 +223,12 @@ module left_half(s=1000, x=0, planar=false)
|
|||
}
|
||||
}
|
||||
}
|
||||
function left_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
function left_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF,
|
||||
x=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[1,0,0], cp=x, p=p);
|
||||
half_of(v=[-1,0,0], cp=x, p=p);
|
||||
|
||||
|
||||
|
||||
|
@ -265,12 +265,12 @@ module right_half(s=1000, x=0, planar=false)
|
|||
}
|
||||
}
|
||||
}
|
||||
function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
function right_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF,
|
||||
x=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[-1,0,0], cp=x, p=p);
|
||||
half_of(v=[1,0,0], cp=x, p=p);
|
||||
|
||||
|
||||
|
||||
|
@ -307,12 +307,12 @@ module front_half(s=1000, y=0, planar=false)
|
|||
}
|
||||
}
|
||||
}
|
||||
function front_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
function front_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF,
|
||||
x=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[0,1,0], cp=x, p=p);
|
||||
half_of(v=[0,-1,0], cp=x, p=p);
|
||||
|
||||
|
||||
|
||||
|
@ -349,12 +349,12 @@ module back_half(s=1000, y=0, planar=false)
|
|||
}
|
||||
}
|
||||
}
|
||||
function back_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
function back_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF,
|
||||
x=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
half_of(v=[0,-1,0], cp=x, p=p);
|
||||
half_of(v=[0,1,0], cp=x, p=p);
|
||||
|
||||
|
||||
|
||||
|
@ -383,8 +383,8 @@ module bottom_half(s=1000, z=0)
|
|||
}
|
||||
}
|
||||
}
|
||||
function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
function bottom_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF,
|
||||
x=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
|
@ -417,8 +417,8 @@ module top_half(s=1000, z=0)
|
|||
}
|
||||
}
|
||||
}
|
||||
function right_half(_arg1=_undef, _arg2=_undef, _arg3=_undef,
|
||||
x=_undef, p=_undef, s=_undef) =
|
||||
function top_half(_arg1=_UNDEF, _arg2=_UNDEF, _arg3=_UNDEF,
|
||||
x=_UNDEF, p=_UNDEF, s=_UNDEF) =
|
||||
let(args=get_named_args([_arg1, _arg2, _arg3],
|
||||
[[x, 0,1], [p,undef,0], [s, 1e4]]),
|
||||
x=args[0], p=args[1], s=args[2])
|
||||
|
|
6
vnf.scad
6
vnf.scad
|
@ -1146,8 +1146,8 @@ function _vnf_halfspace_paths(edges, i=0, paths=[]) =
|
|||
s[0] != s[1] ? [concat(paths[s[0]], paths[s[1]])] :
|
||||
// edge closes a loop
|
||||
[concat(paths[s[0]], [e[1]])]));
|
||||
function vnf_halfspace(_arg1=_undef, _arg2=_undef,
|
||||
halfspace=_undef, vnf=_undef) =
|
||||
function vnf_halfspace(_arg1=_UNDEF, _arg2=_UNDEF,
|
||||
halfspace=_UNDEF, vnf=_UNDEF) =
|
||||
// here is where we wish that OpenSCAD had array lvalues...
|
||||
let(args=get_named_args([_arg1, _arg2], [[halfspace],[vnf]]),
|
||||
halfspace=args[0], vnf=args[1])
|
||||
|
@ -1163,7 +1163,7 @@ function vnf_halfspace(_arg1=_undef, _arg2=_undef,
|
|||
newedges=[for(x=tmp2) each x[1]],
|
||||
// generate new faces
|
||||
paths=_vnf_halfspace_paths(newedges),
|
||||
loops=[for(p=paths) if(p[0] == last(p)) p])
|
||||
loops=[for(p=paths) if(coords[p[0]] == coords[last(p)]) reverse(p)])
|
||||
[coords, concat(newfaces, loops)];
|
||||
|
||||
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||
|
|
Loading…
Reference in a new issue