MinkowskiSum

The Clipper Library

MinkowskiSum

Del.» function MinkowskiSum(const Pattern: TPath; const Path: TPath; PathIsClosed: Boolean): TPaths; overload;

Del.» function MinkowskiSum(const Pattern: TPath; const Paths: TPaths; PathFillType: TPolyFillType; PathIsClosed: Boolean): TPaths; overload;

C++ » void MinkowskiSum(const Path& pattern, const Path& path, Paths& solution, bool pathIsClosed);

C++ » void MinkowskiSum(const Path& pattern, const Paths& paths, Paths& solution, PolyFillType pathFillType, bool pathIsClosed);

C#  » public static Paths MinkowskiSum(Path pattern, Path path, bool pathIsClosed);

C#  » public static Paths MinkowskiSum(Path pattern, Paths paths, PolyFillType pathFillType, bool pathIsClosed);

Minkowski Addition is performed by adding each point in a polygon 'pattern' to the set of points in an open or closed path. The resulting polygon (or polygons) defines the region that the 'pattern' would pass over in moving from the beginning to the end of the 'path'.

      Path path = new Path();
      Path pattern = new Path();
      Paths solution = new Paths();

      //Greek capital sigma (sum sign) ... 
      Int64[] ints1 = new Int64[] { 300, 400, 100, 400, 200, 300, 100, 200, 300, 200 };
      path = IntsToPolygon(ints1);

      //diagonal brush pattern ...
      Int64[] ints2 = new Int64[] { 4, -6, 6, -6, -4, 6, -6, 6 };
      pattern = IntsToPolygon(ints2);

      solution = Clipper.MinkowskiSum(pattern, path, false);
      //move 'pattern' to the end of 'path' ...
      pattern = TranslatePath(pattern, 300, 200);

      //Display solution ± pattern ...
    

See Also

MinkowskiDiff