mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
bug fixes for caps and style
This commit is contained in:
parent
4a179920cf
commit
27928eac70
3 changed files with 23 additions and 20 deletions
|
@ -380,7 +380,7 @@
|
|||
module skin(profiles, slices, refine=1, method="direct", sampling, caps, closed=false, z, style="min_edge", convexity=10,
|
||||
anchor="origin",cp,spin=0, orient=UP, extent=false)
|
||||
{
|
||||
vnf = skin(profiles, slices, refine, method, sampling, caps, closed, z, style);
|
||||
vnf = skin(profiles, slices, refine, method, sampling, caps, closed, z, style=style);
|
||||
attachable(anchor=anchor, spin=spin, orient=orient, vnf=vnf, extent=extent, cp=is_def(cp) ? cp : vnf_centroid(vnf))
|
||||
{
|
||||
vnf_polyhedron(vnf,convexity=convexity);
|
||||
|
@ -390,6 +390,7 @@ module skin(profiles, slices, refine=1, method="direct", sampling, caps, closed=
|
|||
|
||||
|
||||
function skin(profiles, slices, refine=1, method="direct", sampling, caps, closed=false, z, style="min_edge") =
|
||||
let(a=echo(style=style))
|
||||
assert(is_def(slices),"The slices argument must be specified.")
|
||||
assert(is_list(profiles) && len(profiles)>1, "Must provide at least two profiles")
|
||||
let( bad = [for(i=idx(profiles)) if (!(is_path(profiles[i]) && len(profiles[i])>2)) i])
|
||||
|
@ -484,7 +485,7 @@ function skin(profiles, slices, refine=1, method="direct", sampling, caps, close
|
|||
)
|
||||
each subdivide_and_slice(pair,slices[i], nsamples, method=sampling)]
|
||||
)
|
||||
vnf_vertex_array(full_list, caps=fullcaps, col_wrap=true, style=style);
|
||||
vnf_vertex_array(full_list, cap1=fullcaps[0], cap2=fullcaps[1], col_wrap=true, style=style);
|
||||
|
||||
|
||||
|
||||
|
@ -928,7 +929,7 @@ function sweep(shape, transforms, closed=false, caps, style="min_edge") =
|
|||
) vnf :
|
||||
assert(len(shape)>=3, "shape must be a path of at least 3 non-colinear points")
|
||||
vnf_vertex_array([for(i=[0:len(transforms)-(closed?0:1)]) apply(transforms[i%len(transforms)],path3d(shape))],
|
||||
caps=fullcaps,col_wrap=true,style=style);
|
||||
cap1=fullcaps[0],cap2=fullcaps[1],col_wrap=true,style=style);
|
||||
|
||||
|
||||
module sweep(shape, transforms, closed=false, caps, style="min_edge", convexity=10,
|
||||
|
@ -1419,7 +1420,7 @@ function path_sweep2d(shape, path, closed=false, caps, quality=1, style="min_edg
|
|||
vnf_vertex_array([
|
||||
each proflist,
|
||||
if (closed) proflist[0]
|
||||
],caps=fullcaps,col_wrap=true,style=style);
|
||||
],cap1=fullcaps[0],cap1=fullcaps[1],col_wrap=true,style=style);
|
||||
|
||||
|
||||
module path_sweep2d(profile, path, closed=false, caps, quality=1, style="min_edge", convexity=10,
|
||||
|
|
|
@ -8,10 +8,10 @@ module test_skin() {
|
|||
[[-100,-100,100], [-100,100,100], [100,100,100], [100,-100,100]],
|
||||
];
|
||||
vnf1 = skin(profiles, slices=0, caps=false, method="distance");
|
||||
assert_equal(vnf1, [[[-100,-100,0],[0,100,0],[0,100,0],[100,-100,0],[-100,-100,100],[-100,100,100],[100,100,100],[100,-100,100]],[[0,5,4],[0,1,5],[1,6,5],[1,2,6],[2,3,6],[3,7,6],[3,4,7],[3,0,4]]]);
|
||||
assert_equal(vnf1, [[[-100,-100,0],[0,100,0],[0,100,0],[100,-100,0],[-100,-100,100],[-100,100,100],[100,100,100],[100,-100,100]],[[0,5,4],[0,1,5],[5,2,6],[2,3,6],[6,3,7],[3,0,7],[7,0,4]]]);
|
||||
|
||||
vnf2 = skin(profiles, slices=0, caps=true, method="distance");
|
||||
assert_equal(vnf2, [[[-100,-100,0],[0,100,0],[0,100,0],[100,-100,0],[-100,-100,100],[-100,100,100],[100,100,100],[100,-100,100]],[[0,5,4],[0,1,5],[1,6,5],[1,2,6],[2,3,6],[3,7,6],[3,4,7],[3,0,4],[3,2,1,0],[4,5,6,7]]]);
|
||||
vnf_polyhedron(vnf2);
|
||||
assert_equal(vnf2,[[[-100,-100,0],[0,100,0],[0,100,0],[100,-100,0],[-100,-100,100],[-100,100,100],[100,100,100],[100,-100,100]],[[0,5,4],[0,1,5],[5,2,6],[2,3,6],[6,3,7],[3,0,7],[7,0,4],[3,2,1,0],[4,5,6,7]]]);
|
||||
}
|
||||
test_skin();
|
||||
|
||||
|
|
12
vnf.scad
12
vnf.scad
|
@ -155,14 +155,16 @@ function vnf_merge(vnfs, cleanup=false) =
|
|||
) [
|
||||
[for (vnf=vnfs) each vnf[0]],
|
||||
[
|
||||
for (i = idx(vnfs)) let(
|
||||
for (i = idx(vnfs))
|
||||
let(
|
||||
vnf = vnfs[i],
|
||||
verts = vnf[0],
|
||||
faces = vnf[1]
|
||||
)
|
||||
for (face = faces) let(
|
||||
dface = !cleanup ? face :
|
||||
deduplicate_indexed(verts, face, closed=true)
|
||||
for (face = faces)
|
||||
let(
|
||||
dface = !cleanup ? face
|
||||
: deduplicate_indexed(verts, face, closed=true)
|
||||
)
|
||||
if (len(dface) >= 3)
|
||||
[ for (j = dface) offs[i] + j ]
|
||||
|
@ -348,7 +350,7 @@ function vnf_vertex_array(
|
|||
: [[i1,i3,i2],[i1,i4,i3]]
|
||||
)
|
||||
shortface
|
||||
: style=="convex"?
|
||||
: style=="convex"? // This style bombs on degenerate faces
|
||||
let(
|
||||
fsets = [
|
||||
[[i1,i4,i2],[i2,i4,i3]],
|
||||
|
|
Loading…
Reference in a new issue