CMS 3D CMS Logo

IgBSPTree Class Reference

#include <Iguana/Inventor/interface/IgBSPTree.h>

List of all members.

Public Types

enum  { COPLANAR_IN_FRONT, COPLANAR_IN_BACK, COPLANAR_IN_NODE }

Public Member Functions

void add (SoNode *node)
void addOnlyOneFace (SoNode *node)
bool empty (void)
 
Returns:
true if the BSP-Tree is empty.

int getTriangleCount (void)
 IgBSPTree (void)
void intersect (SoNode *node, IgBSPTriangle::List *frontTriangles, IgBSPTriangle::List *backTriangles)
void intersect (IgBSPTriangle *triangle, IgBSPTriangle::List *frontTriangles, IgBSPTriangle::List *backTriangles)
 ~IgBSPTree (void)

Private Attributes

IgBSPNodem_rootNode


Detailed Description

Definition at line 20 of file IgBSPTree.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
COPLANAR_IN_FRONT 
COPLANAR_IN_BACK 
COPLANAR_IN_NODE 

Definition at line 23 of file IgBSPTree.h.

00024     {
00025         COPLANAR_IN_FRONT,
00026         COPLANAR_IN_BACK,
00027         COPLANAR_IN_NODE
00028     };


Constructor & Destructor Documentation

IgBSPTree::IgBSPTree ( void   ) 

Definition at line 54 of file IgBSPTree.cc.

00055     :m_rootNode (0)
00056 {
00057 }

IgBSPTree::~IgBSPTree ( void   ) 

Definition at line 59 of file IgBSPTree.cc.

References m_rootNode.

00060 {
00061     if (m_rootNode)
00062         delete m_rootNode;
00063 }


Member Function Documentation

void IgBSPTree::add ( SoNode *  node  ) 

Definition at line 299 of file IgBSPTree.cc.

References cmsRelvalreport::action, addBestPlane(), m_rootNode, nodeToList(), and IgBSPTriangle::unrefAndDeleteTriangles().

Referenced by IgSurfaceOperation::apply().

00300 {
00301     IgBSPTriangle::List triangleList;
00302     
00303     SoCallbackAction action;
00304     action.addTriangleCallback (SoNode::getClassTypeId (), 
00305                                 nodeToList, 
00306                                 (void *) &triangleList);
00307     action.apply (node);    
00308     
00309     // Add the best splitting planes for this set of triangles.
00310     //    addBestPlane (m_rootNode, triangleList);
00311 
00312     //    if (triangleList.begin () != triangleList.end ())
00313     // {
00314     //  if (m_rootNode == 0)
00315     //  {
00316     //      m_rootNode = new IgBSPNode ((*triangleList.begin ()));
00317     //  }
00318     //  m_rootNode->add (triangleList);    
00319     //}
00320     
00321     addBestPlane (m_rootNode, triangleList);
00322     IgBSPTriangle::unrefAndDeleteTriangles (triangleList);
00323 }

void IgBSPTree::addOnlyOneFace ( SoNode *  node  ) 

Definition at line 66 of file IgBSPTree.cc.

Referenced by IgSurfaceOperation::apply().

00067 {
00068     //    SoCallbackAction action;
00069     //action.addTriangleCallback (SoNode::getClassTypeId (), 
00070     //                          faceToBSP,
00071     //                          (void *) &m_rootNode);
00072     //    action.apply (node);
00073     //std::cerr << "Number of triangles in the BSP tree: " 
00074     // << getTriangleCount () << std::endl;    
00075 }

bool IgBSPTree::empty ( void   ) 

Returns:
true if the BSP-Tree is empty.

Definition at line 378 of file IgBSPTree.cc.

References m_rootNode.

Referenced by intersect().

00379 { return m_rootNode == 0; }

int IgBSPTree::getTriangleCount ( void   ) 

Definition at line 371 of file IgBSPTree.cc.

00372 {
00373     //return m_rootNode ? m_rootNode->getTriangleCount () : -1;    
00374     return 0;    
00375 }

void IgBSPTree::intersect ( SoNode *  node,
IgBSPTriangle::List frontTriangles,
IgBSPTriangle::List backTriangles 
)

Definition at line 347 of file IgBSPTree.cc.

References cmsRelvalreport::action, end, i, intersect(), nodeToList(), and IgBSPTriangle::unrefAndDeleteTriangles().

00350 {
00351     IgBSPTriangle::List triangleList;
00352     
00353     SoCallbackAction action;
00354     action.addTriangleCallback (SoNode::getClassTypeId (), 
00355                                 nodeToList, 
00356                                 (void *) &triangleList);
00357     action.apply (node);
00358 
00359     IgBSPTriangle::List::iterator end (triangleList.end ());
00360     
00361     for (IgBSPTriangle::List::iterator i = triangleList.begin ();
00362          i != end;
00363          i++)
00364     {
00365         intersect ((*i), frontTriangles, backTriangles);        
00366     }
00367     IgBSPTriangle::unrefAndDeleteTriangles (triangleList);  
00368 }

void IgBSPTree::intersect ( IgBSPTriangle triangle,
IgBSPTriangle::List frontTriangles,
IgBSPTriangle::List backTriangles 
)

Definition at line 326 of file IgBSPTree.cc.

References IgBSPNode::add(), empty(), and m_rootNode.

Referenced by IgSurfaceOperation::apply(), and intersect().

00329 {
00330     if (!empty ())
00331     {
00332         // WARNING: add takes ownerwhip of triangle, so such a pointer
00333         // could be not valid anymore after this call.
00334         m_rootNode->add (triangle, 
00335                          false, 
00336                          frontTriangles, 
00337                          backTriangles);    
00338     }
00339     else 
00340     {
00341         //      std::cerr << "IgBSPTree::intersect : doing intersection against empty tree!" 
00342         //        << std::endl; 
00343     }
00344 }


Member Data Documentation

IgBSPNode* IgBSPTree::m_rootNode [private]

Definition at line 49 of file IgBSPTree.h.

Referenced by add(), empty(), intersect(), and ~IgBSPTree().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:02 2009 for CMSSW by  doxygen 1.5.4