0021542: EDF 1699 SMESH: Reorient a group of faces

+  // Return height of the tree, full or from this level to topest leaf
+  int                    getHeight(const bool full=true) const;
This commit is contained in:
eap 2012-06-29 13:47:33 +00:00
parent b998225160
commit dbf098c68f
2 changed files with 28 additions and 1 deletions

View File

@ -175,7 +175,7 @@ bool SMESH_Octree::isLeaf() const
double SMESH_Octree::maxSize() const
{
if ( myBox )
if ( myBox && !myBox->IsVoid() )
{
gp_XYZ min = myBox->CornerMin();
gp_XYZ max = myBox->CornerMax();
@ -185,3 +185,27 @@ double SMESH_Octree::maxSize() const
}
return 0.;
}
//================================================================================
/*!
* \brief Return height of the tree, full or from this level to topest leaf
*/
//================================================================================
int SMESH_Octree::getHeight(const bool full) const
{
if ( full && myFather )
return myFather->getHeight( true );
if ( isLeaf() )
return 1;
int heigth = 0;
for (int i = 0; i<8; i++)
{
int h = myChildren[i]->getHeight( false );
if ( h > heigth )
heigth = h;
}
return heigth + 1;
}

View File

@ -76,6 +76,9 @@ public:
// Return index of a child the given point is in
inline int getChildIndex(double x, double y, double z, const gp_XYZ& boxMiddle)const;
// Return height of the tree, full or from this level to topest leaf
int getHeight(const bool full=true) const;
protected:
// Return box of the whole tree
virtual Bnd_B3d* buildRootBox() = 0;