Ignore:
Timestamp:
10/27/05 18:50:39 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r338 r352  
    55#include "Triangle3.h" 
    66 
    7 ViewCell::ViewCell(): MeshInstance(NULL) 
     7ViewCell::ViewCell(): MeshInstance(NULL), mPiercingRays(0) 
    88{ 
    99} 
    1010 
    11 ViewCell::ViewCell(Mesh *mesh): MeshInstance(mesh) 
     11ViewCell::ViewCell(Mesh *mesh): MeshInstance(mesh), mPiercingRays(0) 
    1212{ 
    1313} 
     
    8080} 
    8181 
     82ViewCell *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 
     95ViewCell *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 
    82128void ViewCell::AddPassingRay(const Ray &ray, const int contributions) 
    83129{ 
Note: See TracChangeset for help on using the changeset viewer.