Skip to content

Commit

Permalink
skin automatically flips faces when paths are reversed; bugfix in rou…
Browse files Browse the repository at this point in the history
…nded_prism
  • Loading branch information
adrianVmariano committed Nov 3, 2024
1 parent 3aff85a commit 400f3ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rounding.scad
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ module rounded_prism(bottom, top, joint_bot=0, joint_top=0, joint_sides=0, k_bot
result = rounded_prism(bottom=bottom, top=top, joint_bot=joint_bot, joint_top=joint_top, joint_sides=joint_sides,
k_bot=k_bot, k_top=k_top, k_sides=k_sides, k=k, splinesteps=splinesteps, h=h, length=length, height=height, l=l,
debug=debug, _full_info=true);
height = one_defined([l,h,height,length], "l,h,height,length", dflt=u_add(bottom_height,top_height));
height = one_defined([l,h,height,length], "l,h,height,length", dflt=undef);
top = is_undef(top) ? path3d(bottom,height/2) :
len(top[0])==2 ? path3d(top,height/2) :
top;
Expand Down
11 changes: 8 additions & 3 deletions skin.scad
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
// 2d curves with heights given in the `z` parameter. It is your responsibility to ensure
// that the resulting polyhedron is free from self-intersections, which would make it invalid
// and can result in cryptic CGAL errors upon rendering with a second object present, even though the polyhedron appears
// OK during preview or when rendered by itself.
// OK during preview or when rendered by itself. The order of points in your profiles must be
// consistent from slice to slice so that points match up without creating twists. You can specify
// profiles in any consistent order: if necessary, skin() will reverse the faces to ensure that the final
// result has clockwise faces as required by CGAL. Note that the face reversal test may give random results
// if you use skin to construct self-intersecting (invalid) polyhedra.
// .
// For this operation to be well-defined, the profiles must all have the same vertex count and
// we must assume that profiles are aligned so that vertex `i` links to vertex `i` on all polygons.
Expand Down Expand Up @@ -502,10 +506,11 @@ function skin(profiles, slices, refine=1, method="direct", sampling, caps, close
refine[i] * len(pair[0])
)
subdivide_and_slice(pair,slices[i], nsamples, method=sampling)],
vnf=vnf_join(
pvnf=vnf_join(
[for(i=idx(full_list))
vnf_vertex_array(full_list[i], cap1=i==0 && fullcaps[0], cap2=i==len(full_list)-1 && fullcaps[1],
col_wrap=true, style=style)])
col_wrap=true, style=style)]),
vnf = vnf_volume(pvnf)<0 ? vnf_reverse_faces(pvnf) : pvnf
)
reorient(anchor,spin,orient,vnf=vnf,p=vnf,extent=atype=="hull",cp=cp);

Expand Down

0 comments on commit 400f3ef

Please sign in to comment.