regionFunction in std::sketch

Create a region from closed segments.

Prefer the segments parameter. It forms a region by tracing the first segment from its start point to the intersection with the second segment, then turning at each intersection using direction until returning to the first segment.

For a single closed segment such as a circle, pass only that segment. intersectionIndex and direction are unnecessary for one loop; use them to disambiguate a boundary traced from multiple segments.

As a fallback, use the point parameter to select the closed boundary that contains a given point. When using a 2D point rather than a point from the sketch, provide the sketch parameter to specify which sketch the region is from.

To make a fallback point move with a parametric sketch, consider creating a construction point in the sketch and constraining it into place. You can then refer to that point to create the region.

Operations such as extrude, revolve, and sweep consume the region passed to them. Each region can be used by only one consuming operation. To reuse the same profile, call region(...) again with the original sketch segments instead of cloning the sketch. For example, create firstRegion = region(segments = [profile.circle]) and secondRegion = region(segments = [profile.circle]), then pass each region to a different consuming operation.

Arguments

NameTypeDescriptionRequired
pointPoint2d or SegmentA fallback point that is within the region's boundary.No
segments[Segment; 1+]The first two segments that form the region's boundary. In case of a circle, the one circle segment that forms the region. This is the preferred way to create a region.No
intersectionIndexnumber(_)Index of the intersection of the first segment with the second segment to use as the region's boundary. The default is -1, which uses the last intersection. This is usually only needed when two or more segments are provided.No
directionstringCCW for counterclockwise, CW for clockwise. Default is CCW. This is usually only needed when two or more segments are provided.No
sketchanyThe sketch that the region is from. This is required when point is a Point2d.No

Returns

Sketch - A sketch is a collection of paths.

Examples