From: eap Date: Fri, 29 Jun 2012 13:47:33 +0000 (+0000) Subject: 0021542: EDF 1699 SMESH: Reorient a group of faces X-Git-Tag: V6_6_0a1~288 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dbf098c68f2bb21f7f333568256c9fca380d5089;p=modules%2Fsmesh.git 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; --- diff --git a/src/SMESHUtils/SMESH_Octree.cxx b/src/SMESHUtils/SMESH_Octree.cxx index 9c06e9f3a..00778a729 100644 --- a/src/SMESHUtils/SMESH_Octree.cxx +++ b/src/SMESHUtils/SMESH_Octree.cxx @@ -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; +} diff --git a/src/SMESHUtils/SMESH_Octree.hxx b/src/SMESHUtils/SMESH_Octree.hxx index eaa27399b..97d767a60 100644 --- a/src/SMESHUtils/SMESH_Octree.hxx +++ b/src/SMESHUtils/SMESH_Octree.hxx @@ -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;