@@ -1397,7 +1397,15 @@ module rotate_sweep(
13971397 : tex_reps;
13981398 tex_depth = is_def(tex_scale)? echo ("In rotate_sweep() the 'tex_scale' parameter is deprecated and has been replaced by 'tex_depth'" )tex_scale
13991399 : default(tex_depth,1 );
1400- region = _force_xplus(force_region(shape));
1400+ region = is_path(shape) && caps ? _force_xplus([deduplicate([[0 ,shape[0 ].y], each shape, [0 ,last(shape).y]])])
1401+ : _force_xplus(force_region(shape));
1402+ ctr2d = centroid(region);
1403+ ctr3d = [ctr2d.x, 0 , ctr2d.y];
1404+ namedanch = angle== 360 ? []
1405+ :[
1406+ named_anchor("start-centroid" , ctr3d, FWD),
1407+ named_anchor("end-centroid" , rot = zrot(angle)* move(ctr3d)* xrot(- 90 )* zrot(180 ))
1408+ ];
14011409 check = assert(is_region(region), "\n Input is not a region or polygon." );
14021410 bounds = pointlist_bounds(flatten(region));
14031411 min_x = bounds[0 ].x;
@@ -1406,13 +1414,6 @@ module rotate_sweep(
14061414 max_y = bounds[1 ].y;
14071415 h = max_y - min_y;
14081416 check2 = assert(min_x>= 0 , "\n Input region must exist entirely in the X+ half-plane." );
1409- ctr2d = centroid(shape);
1410- ctr3d = [ctr2d.x, 0 , ctr2d.y];
1411- namedanch = angle== 360 ? []
1412- :[
1413- named_anchor("start-centroid" , ctr3d, FWD),
1414- named_anchor("end-centroid" , rot = zrot(angle)* move(ctr3d)* xrot(- 90 )* zrot(180 ))
1415- ];
14161417 if (! is_undef(texture)) {
14171418 _textured_revolution(
14181419 shape,
@@ -1434,8 +1435,6 @@ module rotate_sweep(
14341435 )
14351436 change_anchors(named= namedanch) children();
14361437 } else {
1437- region = is_path(shape) && caps ? [deduplicate([[0 ,shape[0 ].y], each shape, [0 ,last(shape).y]])]
1438- : region;
14391438 steps = ceil (segs(max_x) * angle / 360 ) + (angle< 360 ? 1 : 0 );
14401439 skmat = down(min_y) * skew(sxz= shift.x/h, syz= shift.y/h) * up(min_y);
14411440 transforms = [
@@ -2710,8 +2709,8 @@ function sweep(shape, transforms, closed=false, caps, style="min_edge",
27102709 for (rgn= regions) each [
27112710 for (path= rgn)
27122711 sweep(path, transforms, closed= closed, caps= false , style= style),
2713- if (flatcaps[0 ]) vnf_from_region(rgn, transform= transforms[0 ], reverse= true ),
2714- if (flatcaps[1 ]) vnf_from_region(rgn, transform= last(transforms)),
2712+ if (flatcaps[0 ]) vnf_from_region(rgn, transform= transforms[0 ], reverse= true , triangulate = true ), // triangulation needed?
2713+ if (flatcaps[1 ]) vnf_from_region(rgn, transform= last(transforms), triangulate = true ),
27152714 ],
27162715 ],
27172716 vnf = vnf_join(vnfs)
@@ -4783,6 +4782,10 @@ function _textured_revolution(
47834782 testpoly = [[0 ,shape[0 ].y], each shape, [0 ,last(shape).y]]
47844783 )
47854784 [[is_polygon_clockwise(testpoly) ? shape : reverse(shape)]],
4785+
4786+
4787+
4788+
47864789 checks = [
47874790 for (rgn= regions, path= rgn)
47884791 assert(all(path, function (pt) pt.x>= 0 ),"\n All points in the shape must have non-negative x value." ),
0 commit comments