Commit 81d347e0 authored by Dmitry Yu. Naumov's avatar Dmitry Yu. Naumov Committed by Dmitry Yu. Naumov
Browse files

[GL] Add SimplePolygonTree::isRoot query.

parent 673f9917
......@@ -39,7 +39,7 @@ GMSHPolygonTree::~GMSHPolygonTree()
{
// the polylines are processed also by the children, but the root is
// responsible to cleanup up
if (_parent == nullptr)
if (isRoot())
{ // root
for (auto* polyline : _plys)
{
......@@ -55,7 +55,7 @@ void GMSHPolygonTree::markSharedSegments()
return;
}
if (_parent == nullptr)
if (isRoot())
{
return;
}
......@@ -412,7 +412,7 @@ void GMSHPolygonTree::writeSubPolygonsAsLineConstraints(
->writeSubPolygonsAsLineConstraints(line_offset, sfc_number, out);
}
if (_parent != nullptr)
if (!isRoot())
{
const std::size_t n_pnts(_node_polygon->getNumberOfPoints());
std::size_t first_pnt_id(_node_polygon->getPointID(0));
......
......@@ -30,6 +30,11 @@ SimplePolygonTree::~SimplePolygonTree()
}
}
bool SimplePolygonTree::isRoot() const
{
return _parent == nullptr;
}
bool SimplePolygonTree::isPolygonInside(
const SimplePolygonTree* polygon_hierarchy) const
{
......
......@@ -41,6 +41,9 @@ public:
/** Checks if the polygon represented by the given polygon tree node
* is inside this node polygon.
*/
bool isRoot() const;
bool isPolygonInside(const SimplePolygonTree* polygon_hierarchy) const;
/** Either insert the given SimplePolygonTree in one of the existing
* children or as a new child.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment