OffsetPolygons

The Clipper Library

OffsetPolygons

Del.» function OffsetPolygons(const polys: TPolygons; const delta: double; JoinType: TJoinType = jtSquare; MiterLimit: double = 2.0; AutoFix: boolean = true): TPolygons;

C++ » void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, double delta, JoinType jointype = jtSquare, double MiterLimit = 2.0, bool AutoFix = true);

C#  » public static Polygons OffsetPolygons(Polygons polys, double delta, JoinType jointype = JoinType.jtSquare, double MiterLimit = 2.0, bool AutoFix = true);

This function offsets the 'polys' polygons parameter by the 'delta' amount. Positive delta values expand outer polygons and contract inner 'hole' polygons. Negative deltas do the reverse.


Edge joins may be one of three jointypes - jtMiter, jtSquare or jtRound. If the jointype is jtMiter, then the MiterLimit parameter will determine the maximum distance from the original vertex that the new offsetted vertex is allowed (in multiples of delta) before squaring is applied.


It's important that the polygons passed to this function are oriented such that outer polygons have a 'true' orientation and inner 'hole' polygons have a 'false' orientation. If the orientations of input polygons are incorrect, the function will return unexpected results.

The optional AutoFix parameter will check the orientations of the input polygons and reverse them if needed. (AutoFix is optional because it is time-consuming. If the orientations of the input polygons are known to be correct and duplicate vertices don't need stripping, then set this parameter to false.)



See Also

Orientation, JoinType