PolyTree64 is a read-only data structure that receives solutions from clipping operations. It's an alternative to the Paths64 data structure which also receives solutions. However the principle advantage of PolyTree64 over Paths64 is that it also represents the parent-child relationships of the polygons in the solution (where a parent's Polygon will contain all its children Polygons).

The PolyTree64 object that's to receive a clipping solution is passed as a parameter to Clipper64.Execute. When the clipping operation finishes, this object will be populated with data representing the clipped solution.

A PolyTree64 object is a container for any number of PolyPath64 child objects, each representing a single polygon contour. Direct descendants of PolyTree64 will always be outer polygon contours. PolyPath64 children may in turn contain their own children to any level of nesting. Children of outer polygon contours will always represent holes, and children of holes will always represent nested outer polygon contours.

PolyTree64 is a specialised PolyPath64 object that's simply as a container for other PolyPath64 objects and its own polygon property will always be empty.

PolyTree64 will never contain open paths (unlike in Clipper1) since open paths can't contain paths. When clipping open paths, these will always be represented in solutions via a separate Paths64 structure.

C++ Example:
  Paths64 subject, clip;
  PolyTree64 solution_tree;
  //populate subject and clip
  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"));

  //do the clipping
  Clipper64 c;
    FillRule::NonZero, solution_tree);
  //do stuff with solution_tree

C# Example:
  Paths64 subject = new Paths64();
  Paths64 clip = new Paths64();
  PolyTree64 solution_tree = new PolyTree64();

  subject.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 }));

  Clipper64 c = new Clipper64();
    FillRule.NonZero, solution_tree);
  //do stuff with solution_tree

The PolyTree64 structure is much more complex than the Paths64 structure and takes much longer to populate (with clipping operations taking roughly 10-50% longer). Because of this, it's better to use the Paths64 structure in clipping operations unless the parent-child relationships of the returned polygons is important.


Functions Properties
In PolyPath64:
Clear Count

See Also

Overview, Clipper64.Execute, PolyTreeD, Paths64