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 |
|
---|
9 | ViewCell::ViewCell():
|
---|
10 | MeshInstance(NULL),
|
---|
11 | mPiercingRays(0),
|
---|
12 | mArea(0),
|
---|
13 | mVolume(0)
|
---|
14 | {
|
---|
15 | }
|
---|
16 |
|
---|
17 | ViewCell::ViewCell(Mesh *mesh):
|
---|
18 | MeshInstance(mesh),
|
---|
19 | mPiercingRays(0),
|
---|
20 | mArea(0),
|
---|
21 | mVolume(0)
|
---|
22 | {
|
---|
23 | }
|
---|
24 |
|
---|
25 | const ObjectPvs &ViewCell::GetPvs() const
|
---|
26 | {
|
---|
27 | return mPvs;
|
---|
28 | }
|
---|
29 |
|
---|
30 | ObjectPvs &ViewCell::GetPvs()
|
---|
31 | {
|
---|
32 | return mPvs;
|
---|
33 | }
|
---|
34 |
|
---|
35 | int ViewCell::Type() const
|
---|
36 | {
|
---|
37 | return VIEW_CELL;
|
---|
38 | }
|
---|
39 |
|
---|
40 | void ViewCell::AddPassingRay(const Ray &ray, const int contributions)
|
---|
41 | {
|
---|
42 | mPassingRays.AddRay(ray, contributions);
|
---|
43 | }
|
---|
44 |
|
---|
45 |
|
---|
46 | float ViewCell::GetVolume() const
|
---|
47 | {
|
---|
48 | return mVolume;
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | void ViewCell::SetVolume(float volume)
|
---|
53 | {
|
---|
54 | mVolume = volume;
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | float ViewCell::GetArea() const
|
---|
59 | {
|
---|
60 | return mArea;
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | void ViewCell::SetArea(float area)
|
---|
65 | {
|
---|
66 | mArea = area;
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | /************************************************************************/
|
---|
71 | /* class ViewCellsStatistics implementation */
|
---|
72 | /************************************************************************/
|
---|
73 |
|
---|
74 | void 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 | }
|
---|