InflatePaths

Delphifunction InflatePaths(const paths: TPaths64; delta: Double;
  jt: TJoinType; et: TEndType; MiterLimit: double): TPaths64;

Delphifunction InflatePaths(const paths: TPathsD; delta: Double;
  jt: TJoinType; et: TEndType; miterLimit: double; precision: integer): TPathsD;


C++Paths64 InflatePaths(const Paths64& paths, double delta,
  JoinType join_type, EndType end_type, double miter_limit);

C++PathsD InflatePaths(const PathsD& paths, double delta,
  JoinType join_type, EndType end_type, double miter_limit);


C# public static Paths64 InflatePaths(Paths64 paths, double delta,
  JoinType joinType, EndType endType, double miterLimit);

C# public static PathsD InflatePaths(PathsD paths, double delta,
  JoinType joinType, EndType endType, double miterLimit);


These functions encapsulate ClipperOffset, the class that performs both polygon and open path offsetting.

When using this function to inflate polygons (ie closed paths), it's important that you select EndType.Polygon. If instead you select one of the open path end types (including EndType.Join), you'll inflate the polygon's outline. (Example here.)

With closed paths (polygons), a positive delta specifies how much outer polygon contours will expand and how much inner "hole" contours will contract (and the converse with negative deltas).

With open paths (polylines), including EndType.Join, delta specifies the width of the inflated line.

Caution: Offsetting self-intersecting polygons may produce unexpected results.


#include "clipper.h"  
...
using namespace Clipper2Lib;

int main()
{
  PathsD polyline, solution;
  polyline.push_back(MakePathD("100,100, 1500,100, 100,1500, 1500,1500"));
  // offset polyline
  solution = InflatePaths(polyline, 200, JoinType::Miter, EndType::Square);

  //draw polyline and inflated solution
}
      


#include "clipper.h"  
...
using namespace Clipper2Lib;

int main()
{
  PathsD polygon, solution; 
  // add outer polygon contour
  polygon.push_back(Ellipse(RectD(100, 100, 1500, 1500)));
  // add inner "hole" contour
  PathD p = Ellipse(RectD(400, 400, 1200, 1200));
  std::reverse(p.begin(), p.end());
  polygon.push_back(p);

  // offset polygon
  solution = InflatePaths(polygon, 100, JoinType::Round, EndType::Polygon);
  
  //draw polygon and inflated solution
}
      

See Also

ClipperOffset, EndType, JoinType