Union

Delphifunction Union(const subjects: TPaths64; fillRule: TFillRule): TPaths64;

Delphifunction Union(const subjects, clips: TPaths64; fillRule: TFillRule): TPaths64;

Delphifunction Union(const subjects, clips: TPathsD; fillRule: TFillRule; decimalPrec: integer): TPathsD;


C++Paths64 Union(const Paths64& subjects, FillRule fillrule);

C++Paths64 Union(const Paths64& subjects, const Paths64& clips, FillRule fillrule);

C++PathsD Union(const PathsD& subjects, const PathsD& clips, FillRule fillrule, int decimalPrec);


C# public static Paths64 Union(Paths64 subject, FillRule fillRule);

C# public static Paths64 Union(Paths64 subject, Paths64 clip, FillRule fillRule);

C# public static PathsD Union(PathsD subject, PathsD clip, FillRule fillRule, int decimalPrec);


This function 'unions' closed subject paths, with and without clip paths. However, with more complex clipping operations (eg when clipping open paths), you'll need to use the Clipper64 or ClipperD classes directly.

When using floating point types, the precision parameter indicated the desired coordinate precision (up to 8 decimal places).

C++ Example:
  Paths64 subject, clip, solution;
  subject.push_back(MakePath("100, 50, 10, 79, 65, 2, 65, 98, 10, 21"));
  clip.push_back(MakePath("98, 63, 4, 68, 77, 8, 52, 100, 19, 12"));
  solution = Union(subject, clip, FillRule::NonZero);  
  //draw solution

      

C# Example:
  Paths64 subj = new Paths64();
  Paths64 clip = new Paths64();
  subj.Add(Clipper.MakePath(new int[] { 100, 50, 10, 79, 65, 2, 65, 98, 10, 21 }));
  clip.Add(Clipper.MakePath(new int[] { 98, 63, 4, 68, 77, 8, 52, 100, 19, 12 }));
  Paths64 solution = Clipper.Union(subj, clip, FillRule.NonZero);
  //draw solution

      

See Also

Overview, Clipper64, ClipperD, ClipType, FillRule