Difference

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

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


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

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


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

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


This function differences closed subject paths from 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 = Difference(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.Difference(subj, clip, FillRule.NonZero);
  //draw solution

      

  

See Also

Overview, Clipper64, ClipperD, ClipType, FillRule