Intersect

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

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


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

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


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

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


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

      

See Also

Overview, Clipper64, ClipperD, FillRule