Fade2D Documentation pages v2.16.3
Delaunay Features
GEOM_FADE2D::PolygonTree Class Reference

The PolygonTree class represents nested polygon layers as a hierarchical structure. More...

#include <PolygonTree.h>

Public Member Functions

 PolygonTree (int layer_)
 Constructs a PolygonTree object. More...
 
 ~PolygonTree ()
 Destructor for the PolygonTree class.
 
std::vector< PolygonTree * > & getChildren ()
 Retrieves the child nodes of this PolygonTree node. More...
 
void getChildrenRecursive (std::vector< PolygonTree * > &vChildNodesRec)
 Retrieves all child nodes recursively. More...
 
int getLayer () const
 Retrieves the layer number of this PolygonTree node. More...
 
void getSegments_CCW (std::vector< Segment2 > &vSegments) const
 Retrieves counter-clockwise ordered and oriented segments. More...
 
void getSegments_CW (std::vector< Segment2 > &vSegments) const
 Retrieves clockwise ordered and oriented segments. More...
 
void getSegments_regionOriented (std::vector< Segment2 > &vSegments) const
 Retrieves region-oriented segments. More...
 

Detailed Description

The PolygonTree class represents nested polygon layers as a hierarchical structure.

This class organizes nested polygons in a tree-like format, where each layer of the tree corresponds to a polygon layer, progressing from the outermost to the innermost. The direct children of the root node represent layer 0, which corresponds to the outermost polygons (potentially multiple in case of disjoint components). The leaf nodes of the tree correspond to the innermost polygons.

Constructor & Destructor Documentation

◆ PolygonTree()

GEOM_FADE2D::PolygonTree::PolygonTree ( int  layer_)
explicit

Constructs a PolygonTree object.

Parameters
layer_The layer number this tree node represents.

Member Function Documentation

◆ getChildren()

std::vector<PolygonTree*>& GEOM_FADE2D::PolygonTree::getChildren ( )

Retrieves the child nodes of this PolygonTree node.

Returns
A vector of pointers to the child PolygonTree nodes.

◆ getChildrenRecursive()

void GEOM_FADE2D::PolygonTree::getChildrenRecursive ( std::vector< PolygonTree * > &  vChildNodesRec)

Retrieves all child nodes recursively.

This method populates the provided vector with all child nodes of this PolygonTree node, traversing the tree recursively.

Parameters
vChildNodesRecA vector to be filled with the recursive child nodes.

◆ getLayer()

int GEOM_FADE2D::PolygonTree::getLayer ( ) const

Retrieves the layer number of this PolygonTree node.

Returns
The layer number associated with this node.

The root node of the tree has a layer number of -1 and does not contain any segments. Its direct children, which have a layer number of 0, represent the outermost segments. There can be multiple layer-0 nodes for disjoint components of the polygon. The child nodes of the layer-0 nodes correspond to layer 1, representing the next inner layer, and so on.

◆ getSegments_CCW()

void GEOM_FADE2D::PolygonTree::getSegments_CCW ( std::vector< Segment2 > &  vSegments) const

Retrieves counter-clockwise ordered and oriented segments.

This method populates the provided vector with segments ordered and oriented in a counter-clockwise direction.

Parameters
vSegmentsA vector to be filled with CCW-oriented segments.

◆ getSegments_CW()

void GEOM_FADE2D::PolygonTree::getSegments_CW ( std::vector< Segment2 > &  vSegments) const

Retrieves clockwise ordered and oriented segments.

This method fills the provided vector with segments ordered and oriented in a clockwise direction.

Parameters
vSegmentsA vector to be filled with CW-oriented segments.

◆ getSegments_regionOriented()

void GEOM_FADE2D::PolygonTree::getSegments_regionOriented ( std::vector< Segment2 > &  vSegments) const

Retrieves region-oriented segments.

The boundary layer (layer 0) of a polygon defines a transition from empty space to filled area (or from 'air' to 'material'). If a polygon contains a nested polygon, it defines a hole; the hole polygons of layer 1 indicate a transition from material back to air. More generally, considering multiple nested polygon layers from outside to inside signifies alternating transitions between air and material. Even layers represent borders from air to material, while odd layers represent borders to holes ('air') within that material.

This method returns the segments of the current layer, ordered and oriented counter-clockwise around the adjacent 'material' region. Consequently, segments from even polygon layers are oriented counter-clockwise, while those from odd layers are oriented clockwise.

Parameters
vSegmentsA vector to be filled with the region-oriented segments.

The documentation for this class was generated from the following file: