mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-01-16 13:50:23 +01:00
bug fixes
This commit is contained in:
parent
d78eb5213e
commit
d957f556d6
@ -1599,16 +1599,20 @@ function point_in_polygon(point, poly, nonzero=false, eps=EPSILON) =
|
||||
// vnf_wireframe(vnf_tri, d=.15);
|
||||
|
||||
function polygon_triangulate(poly, ind, eps=EPSILON) =
|
||||
let(a=echo(poly=poly)echo(ind=ind))
|
||||
assert(is_path(poly), "Polygon `poly` should be a list of 2d or 3d points")
|
||||
assert(is_undef(ind)
|
||||
|| (is_vector(ind) && min(ind)>=0 && max(ind)<len(poly) ),
|
||||
"Improper or out of bounds list of indices")
|
||||
let( ind = deduplicate_indexed(poly,is_undef(ind) ? count(len(poly)) : ind) )
|
||||
len(ind) < 3 ? [] :
|
||||
len(ind) == 3 ? [ind] :
|
||||
len(poly[ind[0]]) == 3
|
||||
? // represents the polygon projection on its plane as a 2d polygon
|
||||
let(
|
||||
pts = select(poly,ind),
|
||||
nrm = polygon_normal(pts)
|
||||
nrm = polygon_normal(pts),
|
||||
a=echo(pts=pts)echo(nrm=nrm)
|
||||
)
|
||||
// here, instead of an error, it might return [] or undef
|
||||
assert( nrm!=undef,
|
||||
|
@ -1958,7 +1958,8 @@ function rounded_prism(bottom, top, joint_bot=0, joint_top=0, joint_sides=0, k_b
|
||||
vnf = vnf_merge([ each subindex(top_samples,0),
|
||||
each subindex(bot_samples,0),
|
||||
for(pts=edge_points) vnf_vertex_array(pts),
|
||||
vnf_triangulate(vnf_add_faces(EMPTY_VNF,faces))
|
||||
debug ? vnf_add_faces(EMPTY_VNF,faces)
|
||||
: vnf_triangulate(vnf_add_faces(EMPTY_VNF,faces))
|
||||
])
|
||||
)
|
||||
debug ? [concat(top_patch, bot_patch), vnf] : vnf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user