ClipperOffset


Geometric offsetting refers to the process of creating parallel curves that are offset a specified distance from their primary curves.

The ClipperOffset class manages the process of offsetting (inflating/deflating) both open and closed paths using a number of different join types and end types. The library user will rarely need to access this unit directly since it will generally be easier to use the InflatePaths function when doing polygon offsetting.

Notes:

  1. When inflating, it's important not to confuse EndType.Polygon with EndType.Join. EndType.Polygon should only be used when inflating polygons (closed paths), and EndType.Join should only be used with open paths. (See EndType for more details.)
  2. Inflated paths will often contain tiny segments that don't contribute to path shape. These can also represent tiny artefacts that are best removed. (See the RamerDouglasPeucker function.)
  3. Offsetting self-intersecting polygons will most likely produce unexpected results.

C++ Example:
#include "clipper2/clipper.h"  
...
using namespace Clipper2Lib;

int main()
{
  Paths64 subj;
  subj.push_back(MakePath("348,257  364,148  362,148  \
    326,241  295,219  258,88  440,129  370,196  372,275"));

  Paths64 solution = InflatePaths(subj, -7, 
    JoinType::Round, EndType::Polygon);
      
  //draw solution ...
  DrawPolygons(solution, 0x4000FF00, 0xFF009900);
}
      

Reference

Functions Properties
In ClipperOffset:
AddPath ArcTolerance
AddPaths MiterLimit
Clear ReverseSolution
Constructor
Execute

See Also

InflatePaths, RamerDouglasPeucker, EndType