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
11
skin.scad
11
skin.scad
|
@ -379,8 +379,8 @@
|
||||||
// }
|
// }
|
||||||
module skin(profiles, slices, refine=1, method="direct", sampling, caps, closed=false, z, style="min_edge", convexity=10,
|
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)
|
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))
|
attachable(anchor=anchor, spin=spin, orient=orient, vnf=vnf, extent=extent, cp=is_def(cp) ? cp : vnf_centroid(vnf))
|
||||||
{
|
{
|
||||||
vnf_polyhedron(vnf,convexity=convexity);
|
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") =
|
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_def(slices),"The slices argument must be specified.")
|
||||||
assert(is_list(profiles) && len(profiles)>1, "Must provide at least two profiles")
|
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])
|
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)]
|
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 :
|
) vnf :
|
||||||
assert(len(shape)>=3, "shape must be a path of at least 3 non-colinear points")
|
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))],
|
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,
|
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([
|
vnf_vertex_array([
|
||||||
each proflist,
|
each proflist,
|
||||||
if (closed) proflist[0]
|
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,
|
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]],
|
[[-100,-100,100], [-100,100,100], [100,100,100], [100,-100,100]],
|
||||||
];
|
];
|
||||||
vnf1 = skin(profiles, slices=0, caps=false, method="distance");
|
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");
|
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]]]);
|
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]]]);
|
||||||
vnf_polyhedron(vnf2);
|
|
||||||
}
|
}
|
||||||
test_skin();
|
test_skin();
|
||||||
|
|
||||||
|
|
26
vnf.scad
26
vnf.scad
|
@ -155,17 +155,19 @@ function vnf_merge(vnfs, cleanup=false) =
|
||||||
) [
|
) [
|
||||||
[for (vnf=vnfs) each vnf[0]],
|
[for (vnf=vnfs) each vnf[0]],
|
||||||
[
|
[
|
||||||
for (i = idx(vnfs)) let(
|
for (i = idx(vnfs))
|
||||||
vnf = vnfs[i],
|
let(
|
||||||
verts = vnf[0],
|
vnf = vnfs[i],
|
||||||
faces = vnf[1]
|
verts = vnf[0],
|
||||||
)
|
faces = vnf[1]
|
||||||
for (face = faces) let(
|
)
|
||||||
dface = !cleanup ? face :
|
for (face = faces)
|
||||||
deduplicate_indexed(verts, face, closed=true)
|
let(
|
||||||
)
|
dface = !cleanup ? face
|
||||||
if (len(dface) >= 3)
|
: deduplicate_indexed(verts, face, closed=true)
|
||||||
[ for (j = dface) offs[i] + j ]
|
)
|
||||||
|
if (len(dface) >= 3)
|
||||||
|
[ for (j = dface) offs[i] + j ]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -348,7 +350,7 @@ function vnf_vertex_array(
|
||||||
: [[i1,i3,i2],[i1,i4,i3]]
|
: [[i1,i3,i2],[i1,i4,i3]]
|
||||||
)
|
)
|
||||||
shortface
|
shortface
|
||||||
: style=="convex"?
|
: style=="convex"? // This style bombs on degenerate faces
|
||||||
let(
|
let(
|
||||||
fsets = [
|
fsets = [
|
||||||
[[i1,i4,i2],[i2,i4,i3]],
|
[[i1,i4,i2],[i2,i4,i3]],
|
||||||
|
|
Loading…
Reference in a new issue