source: trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp @ 478

Revision 478, 2.0 KB checked in by mattausch, 19 years ago (diff)
Line 
1#include "ViewCell.h"
2#include "Mesh.h"
3#include "Intersectable.h"
4#include "MeshKdTree.h"
5#include "Triangle3.h"
6#include <time.h>
7#include <iomanip>
8
9ViewCell::ViewCell():
10MeshInstance(NULL),
11mPiercingRays(0),
12mArea(0),
13mVolume(0)
14{
15}
16
17ViewCell::ViewCell(Mesh *mesh):
18MeshInstance(mesh),
19mPiercingRays(0),
20mArea(0),
21mVolume(0)
22{
23}
24
25const ObjectPvs &ViewCell::GetPvs() const
26{
27        return mPvs;
28}
29
30ObjectPvs &ViewCell::GetPvs()
31{
32        return mPvs;
33}
34
35int ViewCell::Type() const
36{
37        return VIEW_CELL;
38}
39
40void ViewCell::AddPassingRay(const Ray &ray, const int contributions)
41{
42        mPassingRays.AddRay(ray, contributions);
43}
44
45
46float ViewCell::GetVolume() const
47{
48        return mVolume;
49}
50
51
52void ViewCell::SetVolume(float volume)
53{
54        mVolume = volume;
55}
56
57
58float ViewCell::GetArea() const
59{
60        return mArea;
61}
62
63
64void ViewCell::SetArea(float area)
65{
66        mArea = area;
67}
68
69
70/************************************************************************/
71/*                class ViewCellsStatistics implementation              */
72/************************************************************************/
73
74void ViewCellsStatistics::Print(ostream &app) const
75{
76        app << "=========== View Cells Statistics ===============\n";
77
78        app << setprecision(4);
79
80        //app << "#N_CTIME  ( Construction time [s] )\n" << Time() << " \n";
81
82        app << "#N_OVERALLPVS ( objects in PVS )\n" << pvs << endl;
83
84        app << "#N_PMAXPVS ( largest PVS )\n" << maxPvs << endl;
85
86        app << "#N_PMINPVS ( smallest PVS )\n" << minPvs << endl;
87
88        app << "#N_PAVGPVS ( average PVS )\n" << AvgPvs() << endl;
89
90        app << "#N_PEMPTYPVS ( view cells with PVS smaller 2 )\n" << emptyPvs << endl;
91
92        app << "#N_VIEWCELLS ( number of view cells)\n" << viewCells << endl;
93
94        app << "#N_AVGLEAVES (average number of leaves per view cell )\n" << AvgLeaves() << endl;
95
96        app << "#N_MAXLEAVES ( maximal number of leaves per view cell )\n" << maxLeaves << endl;
97       
98        app << "========== End of View Cells Statistics ==========\n";
99}
Note: See TracBrowser for help on using the repository browser.