double SMESH_Octree::maxSize() const
{
- if ( myBox )
+ if ( myBox && !myBox->IsVoid() )
{
gp_XYZ min = myBox->CornerMin();
gp_XYZ max = myBox->CornerMax();
}
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;
+}
// 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;