Ignore:
Timestamp:
12/13/05 17:28:02 (19 years ago)
Author:
mattausch
Message:

worked on vsp kd view cells

File:
1 edited

Legend:

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

    r454 r462  
    55#include "Containers.h" 
    66#include "Ray.h" 
    7  
     7#include "Statistics.h" 
    88//namespace GtpVisibilityPreprocessor { 
    99   
     
    1313class BspLeaf; 
    1414class VspKdTree; 
    15 class VspKdTreeLeaf; 
     15class VspKdLeaf; 
     16 
    1617 
    1718/** 
     
    2223public: 
    2324        ViewCell(); 
     25         
    2426        /** Constructor taking a mesh representing the shape of the viewcell. 
    2527        */ 
    2628        ViewCell(Mesh *mesh); 
     29 
     30 
     31        virtual ~ViewCell() {} 
    2732        /** Returns Pvs.  
    2833        */ 
     
    6772        ViewCell(mesh), mVspKdLeaves(0) {} 
    6873 
    69         float GetSize() {return 0;} 
     74        float GetSize() {return mSize;} 
    7075        void SetSize(float size) {mSize = size;} 
    7176 
    7277        /// Leaves which hold this view cell. 
    73         vector<VspKdTreeLeaf *> mVspKdLeaves; 
     78        vector<VspKdLeaf *> mVspKdLeaves; 
    7479 
    7580protected: 
    7681        float mSize; 
    7782}; 
     83 
     84class ViewCellsStatistics: public StatisticsBase 
     85{ 
     86public: 
     87 
     88        /// number of view cells 
     89        int viewCells; 
     90 
     91        /// size of the PVS 
     92        int pvs; 
     93   
     94        /// largest PVS of all view cells 
     95        int maxPvs; 
     96 
     97        /// smallest PVS of all view cells 
     98        int minPvs; 
     99 
     100        /// view cells with empty PVS 
     101        int emptyPvs; 
     102 
     103        /// number of leaves covering the view space 
     104        int leaves; 
     105 
     106        /// largest number of leaves covered by one view cell   
     107        int maxLeaves; 
     108 
     109    // Constructor 
     110        ViewCellsStatistics()  
     111        { 
     112                Reset(); 
     113        } 
     114 
     115        double AvgLeaves() const {return (double)leaves / (double)viewCells;}; 
     116        double AvgPvs() const {return (double)pvs / (double)viewCells;}; 
     117   
     118        void Reset()  
     119        { 
     120                viewCells = 0;   
     121                pvs = 0;   
     122                maxPvs = 0; 
     123 
     124                minPvs = 999999; 
     125                emptyPvs = 0; 
     126                leaves = 0; 
     127                maxLeaves = 0; 
     128        } 
     129 
     130        void Print(ostream &app) const; 
     131 
     132        friend ostream &operator<<(ostream &s, const ViewCellsStatistics &stat)  
     133        { 
     134                stat.Print(s); 
     135                return s; 
     136        }   
     137}; 
     138 
    78139#endif 
Note: See TracChangeset for help on using the changeset viewer.