diff --git a/rounding.scad b/rounding.scad index d75f7efd..5b9d1381 100644 --- a/rounding.scad +++ b/rounding.scad @@ -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; diff --git a/skin.scad b/skin.scad index bce4e31e..6ba2c1e6 100644 --- a/skin.scad +++ b/skin.scad @@ -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. @@ -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);