Skip to content

ClipperOffset NonNegativeInput

Seth Hillbrand edited this page Dec 1, 2026 · 2 revisions

Home › clipper.offset.h › ClipperOffset › ClipperOffset.NonNegativeInput

ClipperOffset.NonNegativeInput

bool NonNegativeInput() const;
void NonNegativeInput(bool non_negative_input);

Only set this when the combined input never winds negatively once each group's orientation has been applied. The closed solution of a boolean operation like Union, added in a single AddPaths call, meets this but its open solution paths do not. The default is false.

With this set, a growing offset (delta > 0) of polygons using JoinType::Round can emit a concave join as the single point where its two offset edges cross. Normally the offsetter emits three vertices at a concave join and the final union then has to remove the small loop they form. Using the crossing point skips that work.

This setting is ignored unless: 1. every group uses JoinType::Round with EndType::Polygon, 2. delta is positive and below 244, 3. there is no delta callback assigned and 4. the ArcTolerance gives at least two steps per half circle. Joins still fall back to normal concave handling if the edges are too short for the crossing to cover the loop, if the join turns more than 90° or if coordinates at the join or either neighbor are too large for a double to place the crossing within a unit.

Caution: The crossing point rounds differently from the points it replaces. This means that boundaries may move by about a unit, and features narrower than a unit may open or close. Under USINGZ, the crossing keeps its input vertex's z and the z callback isn't called for it. Never set this for raw input that may contain overlapping or protruding holes. Negative winding there will make the solution wrong.

Paths64 region = Union(subject, FillRule::NonZero);
ClipperOffset offsetter;
offsetter.NonNegativeInput(true); // region is a boolean result
offsetter.AddPaths(region, JoinType::Round, EndType::Polygon);
Paths64 solution;
offsetter.Execute(100, solution);

See Also

ArcTolerance, Union, EndType, JoinType, USINGZ

Clone this wiki locally