Boolean union
This operation returns a vector of CrossSections that are topologically disconnected, each containing one outline contour with zero or more holes.
Constructs a manifold by extruding the cross-section along Z-axis.
Z-extent of extrusion.
Optional
nDivisions: numberNumber of extra copies of the crossSection to insert into the shape vertically; especially useful in combination with twistDegrees to avoid interpolation artifacts. Default is none.
Optional
twistDegrees: numberAmount to twist the top crossSection relative to the bottom, interpolated linearly for the divisions in between.
Optional
scaleTop: number | Vec2Amount to scale the top (independently in X and Y). If the scale is {0, 0}, a pure cone is formed with only a single vertex at the top. Default {1, 1}.
Optional
center: booleanIf true, the extrusion is centered on the z-axis through the origin as opposed to resting on the XY plane as is default.
Compute the convex hull of the contours in this CrossSection.
Boolean intersection
Mirror this CrossSection over the arbitrary axis described by the unit form of the given vector. If the length of the vector is zero, an empty CrossSection is returned. This operation can be chained. Transforms are combined and applied lazily.
the axis to be mirrored over
Inflate the contours in CrossSection by the specified delta, handling corners according to the given JoinType.
Positive deltas will cause the expansion of outlining contours to expand, and retraction of inner (hole) contours. Negative deltas will have the opposite effect.
Optional
joinType: JoinTypeThe join type specifying the treatment of contour joins (corners).
Optional
miterLimit: numberThe maximum distance in multiples of delta that vertices can be offset from their original positions with before squaring is applied, when the join type is Miter (default is 2, which is the minimum allowed). See the Clipper2 MiterLimit page for a visual example.
Optional
circularSegments: numberNumber of segments per 360 degrees of JoinType::Round corners (roughly, the number of vertices that will be added to each contour). Default is calculated by the static Quality defaults according to the radius.
Constructs a manifold by revolving this cross-section around its Y-axis and then setting this as the Z-axis of the resulting manifold. If the contours cross the Y-axis, only the part on the positive X side is used. Geometrically valid input will result in geometrically valid output.
Optional
circularSegments: numberNumber of segments along its diameter. Default is calculated by the static Defaults.
Optional
revolveDegrees: numberApplies a (Z-axis) rotation to the CrossSection, in degrees. This operation can be chained. Transforms are combined and applied lazily.
degrees about the Z-axis to rotate.
Scale this CrossSection in space. This operation can be chained. Transforms are combined and applied lazily.
The vector to multiply every vertex by per component.
Remove vertices from the contours in this CrossSection that are less than the specified distance epsilon from an imaginary line that passes through its two adjacent vertices. Near duplicate vertices and collinear points will be removed at lower epsilons, with elimination of line segments becoming increasingly aggressive with larger epsilons.
It is recommended to apply this function following Offset, in order to clean up any spurious tiny line segments introduced that do not improve quality in any meaningful way. This is particularly important if further offseting operations are to be performed, which would compound the issue.
Optional
epsilon: numberminimum distance vertices must diverge from the hypothetical outline without them in order to be included in the output (default 1e-6)
Boolean difference
Return the contours of this CrossSection as a list of simple polygons.
Transform this CrossSection in space. Stored in column-major order. This operation can be chained. Transforms are combined and applied lazily.
The affine transformation matrix to apply to all the vertices. The last row is ignored.
Move this CrossSection in space. This operation can be chained. Transforms are combined and applied lazily.
The vector to add to every vertex.
Optional
y: numberMove the vertices of this CrossSection (creating a new one) according to any arbitrary input function, followed by a union operation (with a Positive fill rule) that ensures any introduced intersections are not included in the result.
Static
circleConstructs a circle of a given radius.
Radius of the circle. Must be positive.
Optional
circularSegments: numberNumber of segments along its diameter. Default is calculated by the static Quality defaults according to the radius.
Static
composeConstruct a CrossSection from a vector of other Polygons (batch boolean union).
Static
differenceBoolean difference of the cross-section b from the cross-section a
Boolean difference of the tail of a list of cross-sections from its head
Static
hullCompute the convex hull of all points in a list of polygons/cross-sections.
Static
intersectionBoolean intersection of the cross-sections a and b
Boolean intersection of a list of cross-sections
Static
ofCreate a 2d cross-section from a set of contours (complex polygons). A boolean union operation (with Positive filling rule by default) is performed to combine overlapping polygons and ensure the resulting CrossSection is free of intersections.
Static
squareConstructs a square with the given XY dimensions. By default it is positioned in the first quadrant, touching the origin. If any dimensions in size are negative, or if all are zero, an empty Manifold will be returned.
Optional
size: number | Vec2The X, and Y dimensions of the square.
Optional
center: booleanSet to true to shift the center to the origin.
Static
unionBoolean union of the cross-sections a and b
Boolean union of a list of cross-sections
Create a 2d cross-section from a set of contours (complex polygons). A boolean union operation (with Positive filling rule by default) is performed to combine overlapping polygons and ensure the resulting CrossSection is free of intersections.