Ignore:
Timestamp:
08/10/05 18:07:51 (19 years ago)
Author:
mattausch
Message:

added bsp tree stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/ViewCellBsp.h

    r233 r234  
    1717 
    1818typedef std::queue<Polygon *> PolygonQueue; 
     19 
     20class BspTreeStatistics // TODO: should have common superclass with KdTreeStatistics 
     21{ 
     22public: 
     23  // total number of nodes 
     24  int nodes; 
     25  // totals number of rays 
     26  int rays; 
     27  // total number of query domains 
     28  int queryDomains; 
     29  // total number of ray references 
     30  int rayRefs; 
     31  // refs in non empty leafs 
     32  int rayRefsNonZeroQuery; 
     33  // total number of query references 
     34  int objectRefs; 
     35  // nodes with zero queries 
     36  int zeroQueryNodes; 
     37  // max depth nodes 
     38  int maxDepthNodes; 
     39  // max number of rays per node 
     40  int maxObjectRefs; 
     41  // number of dynamically added ray refs 
     42  int addedRayRefs; 
     43  // number of dynamically removed ray refs 
     44  int removedRayRefs; 
     45   
     46  // Constructor 
     47  BspTreeStatistics()  
     48  { 
     49    Reset(); 
     50  } 
     51 
     52  int Nodes() const {return nodes;} 
     53  int Interior() const { return nodes/2; } 
     54  int Leaves() const { return (nodes/2) + 1; } 
     55 
     56  void Reset()  
     57  { 
     58          nodes = 0; 
     59 
     60          rays = queryDomains = 0; 
     61          rayRefs = rayRefsNonZeroQuery = objectRefs = 0; 
     62          zeroQueryNodes = 0; 
     63      maxDepthNodes = 0; 
     64      //minCostNodes = 0; 
     65          maxObjectRefs = 0; 
     66          addedRayRefs = removedRayRefs = 0; 
     67  } 
     68 
     69  void 
     70  Print(ostream &app) const; 
     71 
     72  friend ostream &operator<<(ostream &s, const BspTreeStatistics &stat) { 
     73    stat.Print(s); 
     74    return s; 
     75  } 
     76   
     77}; 
    1978 
    2079/** 
     
    179238        /** Builds a new extension of the tree. 
    180239        */ 
    181         void BuildTree(BspTraversalStack &tStack, BspTraversalData &currentData); 
     240        void BuildTree(BspTraversalStack &tStack, BspTraversalData &currentData, ViewCell *viewCell = NULL); 
    182241 
    183242        /** Selects a splitting plane from the given polygons.  
     
    232291        /// maximal depth 
    233292        int mMaxDepth; 
     293 
     294        BspTreeStatistics mStat; 
    234295}; 
    235296 
Note: See TracChangeset for help on using the changeset viewer.