mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-30 08:19:36 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
d90297d236
4 changed files with 24 additions and 7 deletions
|
@ -95,10 +95,10 @@ function half_of(p, v=UP, cp) =
|
|||
assert(is_vector(v,2) || (is_vector(v,3) && v.z==0),"Must give 2-vector")
|
||||
assert(!all_zero(v), "Vector v must be nonzero")
|
||||
let(
|
||||
bounds = pointlist_bounds(move(-cp,p)),
|
||||
L = 2*max(flatten(bounds)),
|
||||
n = unit(v),
|
||||
u = [-n.y,n.x],
|
||||
v=unit(v),
|
||||
bounds = pointlist_bounds(is_region(p)?flatten(p):p),
|
||||
L = 2*max(norm(bounds[0]-cp), norm(bounds[1]-cp)),
|
||||
u = [-v.y,v.x],
|
||||
box = [cp+u*L, cp+(v+u)*L, cp+(v-u)*L, cp-u*L]
|
||||
)
|
||||
intersection(box,p)
|
||||
|
|
|
@ -2099,7 +2099,7 @@ function sweep(shape, transforms, closed=false, caps, style="min_edge",
|
|||
capsOK = is_bool(caps) || is_bool_list(caps,2),
|
||||
fullcaps = is_bool(caps) ? [caps,caps] : caps
|
||||
)
|
||||
assert(len(transforms), "transformation must be length 2 or more")
|
||||
assert(len(transforms)>=2, "transformation must be length 2 or more")
|
||||
assert(capsOK, "caps must be boolean or a list of two booleans")
|
||||
assert(!closed || !caps, "Cannot make closed shape with caps")
|
||||
is_region(shape)? let(
|
||||
|
@ -2108,7 +2108,7 @@ function sweep(shape, transforms, closed=false, caps, style="min_edge",
|
|||
vnfs = [
|
||||
for (rgn=regions) each [
|
||||
for (path=rgn)
|
||||
sweep(path, transforms, closed=closed, caps=false),
|
||||
sweep(path, transforms, closed=closed, caps=false, style=style),
|
||||
if (fullcaps[0]) vnf_from_region(rgn, transform=transforms[0], reverse=true),
|
||||
if (fullcaps[1]) vnf_from_region(rgn, transform=last(transforms)),
|
||||
],
|
||||
|
|
|
@ -16,4 +16,21 @@ module test_skin() {
|
|||
test_skin();
|
||||
|
||||
|
||||
module test_sweep() {
|
||||
multi_region = [
|
||||
[[10, 0], [ 0, 0], [ 0, 10], [10, 10]],
|
||||
[[30, 0], [20, 0], [20, 10], [30, 10]]
|
||||
];
|
||||
transforms = [ up(10), down(10) ];
|
||||
|
||||
vnf1 = sweep(multi_region,transforms,closed=false,caps=false);
|
||||
assert(len(vnf1[0])==8*2 && len(vnf1[1])==8*2);
|
||||
|
||||
vnf2 = sweep(multi_region,transforms,closed=false,caps=false,style="quincunx");
|
||||
assert(len(vnf2[0])==8*3 && len(vnf2[1])==8*4);
|
||||
}
|
||||
test_sweep();
|
||||
|
||||
|
||||
|
||||
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
BOSL_VERSION = [2,0,675];
|
||||
BOSL_VERSION = [2,0,677];
|
||||
|
||||
|
||||
// Section: BOSL Library Version Functions
|
||||
|
|
Loading…
Reference in a new issue