Skip to content

PolyPath64 Child

Seth Hillbrand edited this page Oct 29, 2026 · 2 revisions

Home › clipper.engine.h › PolyPath64 › PolyPath64.Child

PolyPath64.Child

const PolyPath64* Child(size_t index) const
const PolyPath64* operator [] (size_t index) const

Child is perhaps the most explicit way of accessing children (ie nested polygon contours that are contained within Polygon).
The array operator [ ] is another (simpler) way of access children, and iterators can also be used.

Example:

// nice and simple
for (const auto& poly : polytree)
  for (const auto& hole : *poly)
  {
    if (!hole->IsHole() || hole->Level() != 2)
      std::cout << "oops!";
  }
// or full disclosure
PolyPath64List::const_iterator ppi, ppi2;
for (ppi = polytree.begin(); ppi != polytree.end(); ++ppi)
  for (ppi2 = (*ppi)->begin(); ppi != (*ppi)->end(); ++ppi2)
  {
    const std::unique_ptr<PolyPath64>& hole = *ppi2;
    if (!hole->IsHole() || hole->Level() != 2)
      std::cout << "oops!";
  }

// and other somewhat messy options
const auto& first_poly = polytree.Child(0);
if (first_poly->Count() && 
  first_poly->Child(0)->Level() != 2 ||
  !first_poly[0].IsHole())
    std::cout << "oops!" << std::endl;

See Also

Polygon

Clone this wiki locally