Changeset 352 for trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
- Timestamp:
- 10/27/05 18:50:39 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/ViewCell.cpp
r338 r352 5 5 #include "Triangle3.h" 6 6 7 ViewCell::ViewCell(): MeshInstance(NULL) 7 ViewCell::ViewCell(): MeshInstance(NULL), mPiercingRays(0) 8 8 { 9 9 } 10 10 11 ViewCell::ViewCell(Mesh *mesh): MeshInstance(mesh) 11 ViewCell::ViewCell(Mesh *mesh): MeshInstance(mesh), mPiercingRays(0) 12 12 { 13 13 } … … 80 80 } 81 81 82 ViewCell *ViewCell::MergeViewCells(const ViewCell &front, const ViewCell &back) 83 { 84 /*stable_sort(front.mPiercingRays.begin(), front.mPiercingRays.end()); 85 stable_sort(back.mPiercingRays.begin(), back.mPiercingRays.end()); 86 87 ViewCell *vc = front.Merge(back); 88 89 if (vc) 90 return vc; 91 92 return back.Merge(front);*/return NULL; 93 } 94 95 ViewCell *ViewCell::Merge(const ViewCell &other) const 96 { 97 //-- compute set differences 98 const float minDif = 10; 99 100 RayContainer diff; 101 102 set_difference(mPiercingRays.begin(), mPiercingRays.end(), 103 other.mPiercingRays.begin(), other.mPiercingRays.end(), 104 diff.begin()); 105 106 if (diff.size() < minDif) 107 { 108 ViewCell *vc = new ViewCell(); 109 110 RayContainer::const_iterator it, it_end = other.mPiercingRays.end(); 111 112 for (it = other.mPiercingRays.begin(); it != it_end; ++ it) 113 vc->mPiercingRays.push_back(*it); 114 115 while (!diff.empty()) 116 { 117 vc->mPiercingRays.push_back(diff.back()); 118 diff.pop_back(); 119 } 120 121 return vc; 122 } 123 124 return NULL; 125 } 126 127 82 128 void ViewCell::AddPassingRay(const Ray &ray, const int contributions) 83 129 {
Note: See TracChangeset
for help on using the changeset viewer.