Changeset 1932


Ignore:
Timestamp:
01/03/07 01:36:35 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp

    r1928 r1932  
    4646        Debug << "eps: " << mEps << endl; 
    4747 
    48         mStats.open("gvspreprocessor.log"); 
     48        mGvsStats.open("gvspreprocessor.log"); 
    4949} 
    5050 
     
    5454                                                                                 const VssRay &oldRay) 
    5555{ 
    56         const float dist = Magnitude(oldRay.GetDir()); 
    57         const float newDist = Magnitude(currentRay.GetDir()); 
    58   
    59 #if 0 
    60         if ((dist - newDist) > mThresHold) 
    61 #else  
    62         // rather take relative distance 
    63         if ((dist / newDist) > mThreshold) 
    64 #endif 
    65         { 
     56        // the predicted hitpoint: we expect to hit the same mesh again 
     57        const Vector3 predictedHit = CalcPredictedHitPoint(currentRay, hitTriangle, oldRay); 
     58 
     59        const float predictedLen = Magnitude(predictedHit - currentRay.mOrigin); 
     60        const float len = Magnitude(currentRay.mTermination - currentRay.mOrigin); 
     61         
     62        // distance large => this is likely to be a discontinuity 
     63        if ((predictedLen - len) > mThreshold) 
     64        { 
     65                cout << "d"; 
    6666                VssRay *newRay = ReverseSampling(currentRay, hitTriangle, oldRay); 
     67                 
    6768                // set flag for visualization 
    6869                newRay->mFlags |= VssRay::ReverseSample; 
    6970                 
    70                 // ray is not pushed into the queue => can delete ray 
     71                // if ray is not further processed => can delete ray 
    7172                if (!HandleRay(newRay)) 
    7273                        delete newRay; 
     
    8182bool GvsPreprocessor::HandleRay(VssRay *vssRay) 
    8283{ 
     84        // compute the contribution to the view cells 
    8385        const bool storeRaysForViz = true; 
    84         mViewCellsManager->ComputeSampleContribution(*vssRay, true, storeRaysForViz); 
    85                  
     86        mViewCellsManager->ComputeSampleContribution(*vssRay,  
     87                                                                                                 true,  
     88                                                                                                 storeRaysForViz); 
     89 
    8690        // some pvs contribution for this ray? 
    8791        if (vssRay->mPvsContribution > 0) 
     
    9296                if (storeRaysForViz) 
    9397                { 
     98                        VssRay *nray = new VssRay(*vssRay); 
     99                        nray->mFlags = vssRay->mFlags; 
     100 
     101                        // store ray in contributing view cell 
    94102                        ViewCellContainer::const_iterator vit, vit_end = vssRay->mViewCells.end(); 
    95103                        for (vit = vssRay->mViewCells.begin(); vit != vit_end; ++ vit) 
    96                         { 
    97                                 VssRay *nray = new VssRay(*vssRay); 
     104                        {                        
    98105                                (*vit)->GetOrCreateRays()->push_back(nray);                              
    99106                        } 
    100107                } 
     108 
    101109                //mVssRays.push_back(new VssRay(*vssRay)); 
    102110        ++ mSampleContriPerPass; 
     
    111119/** Creates 3 new vertices for triangle vertex with specified index. 
    112120*/ 
    113 static void CreateNewVertices(VertexContainer &vertices, 
    114                                                           const Triangle3 &hitTriangle, 
    115                                                           const VssRay &ray,  
    116                                                           const int index, 
    117                                                           const float eps) 
     121void GvsPreprocessor::CreateDisplacedVertices(VertexContainer &vertices, 
     122                                                                                          const Triangle3 &hitTriangle, 
     123                                                                                          const VssRay &ray,  
     124                                                                                          const int index) const 
    118125{ 
    119126        const int indexU = (index + 1) % 3; 
     
    125132         
    126133        const float len = Magnitude(a); 
    127  
     134         
    128135        const Vector3 dir1 = Normalize(CrossProd(a, b)); //N((pi-xp)×(pi+1- pi)); 
    129136        const Vector3 dir2 = Normalize(CrossProd(a, c)); // N((pi-xp)×(pi- pi-1)) 
     
    133140        // compute the new three hit points 
    134141        // pi, i + 1:  pi+ e·|pi-xp|·di, j 
    135         const Vector3 pt1 = hitTriangle.mVertices[index] + eps * len * dir1; 
     142        const Vector3 pt1 = hitTriangle.mVertices[index] + mEps * len * dir1; 
    136143        // pi, i - 1:  pi+ e·|pi-xp|·di, j 
    137     const Vector3 pt2 = hitTriangle.mVertices[index] + eps * len * dir2; 
     144    const Vector3 pt2 = hitTriangle.mVertices[index] + mEps * len * dir2; 
    138145        // pi, i:  pi+ e·|pi-xp|·di, j 
    139         const Vector3 pt3 = hitTriangle.mVertices[index] + eps * len * dir3; 
     146        const Vector3 pt3 = hitTriangle.mVertices[index] + mEps * len * dir3; 
    140147         
    141148        vertices.push_back(pt2); 
     
    147154void GvsPreprocessor::EnlargeTriangle(VertexContainer &vertices, 
    148155                                                                          const Triangle3 &hitTriangle, 
    149                                                                           const VssRay &ray) 
    150 { 
    151         CreateNewVertices(vertices, hitTriangle, ray, 0, mEps); 
    152         CreateNewVertices(vertices, hitTriangle, ray, 1, mEps); 
    153         CreateNewVertices(vertices, hitTriangle, ray, 2, mEps); 
    154 } 
    155  
    156  
    157 static Vector3 CalcPredictedHitPoint(const VssRay &newRay,  
    158                                                                          const Triangle3 &hitTriangle, 
    159                                                                          const VssRay &oldRay) 
    160 { 
     156                                                                          const VssRay &ray) const 
     157{ 
     158        CreateDisplacedVertices(vertices, hitTriangle, ray, 0); 
     159        CreateDisplacedVertices(vertices, hitTriangle, ray, 1); 
     160        CreateDisplacedVertices(vertices, hitTriangle, ray, 2); 
     161} 
     162 
     163 
     164Vector3 GvsPreprocessor::CalcPredictedHitPoint(const VssRay &newRay,  
     165                                                                                           const Triangle3 &hitTriangle, 
     166                                                                                           const VssRay &oldRay) const 
     167{ 
     168        // find the intersection of the plane induced by the  
     169        // hit triangle with the new ray 
    161170        Plane3 plane(hitTriangle.GetNormal(), hitTriangle.mVertices[0]); 
    162171 
     
    177186                                                                   const Vector3 &p1,  
    178187                                                                   const Vector3 &p2,  
    179                                                                    const VssRay &x,  
    180                                                                    const VssRay &y, 
     188                                                                   const VssRay &ray1,  
     189                                                                   const VssRay &ray2, 
    181190                                                                   const VssRay &oldRay) 
    182191{ 
    183         // the predicted hitpoint expects to hit the same mesh again 
    184         const Vector3 predictedHitX = CalcPredictedHitPoint(x, hitTriangle, oldRay); 
    185         const Vector3 predictedHitY = CalcPredictedHitPoint(y, hitTriangle, oldRay); 
    186  
    187         CheckDiscontinuity(x, hitTriangle, oldRay); 
    188         CheckDiscontinuity(y, hitTriangle, oldRay); 
    189  
    190         if (EqualVisibility(x, y)) 
     192        CheckDiscontinuity(ray1, hitTriangle, oldRay); 
     193        CheckDiscontinuity(ray2, hitTriangle, oldRay); 
     194 
     195        if (EqualVisibility(ray1, ray2) || (Magnitude(p1 - p2) <= mEps)) 
    191196        { 
    192197                return 0; 
     
    194199        else 
    195200        { 
    196                 cout << "s"; 
     201                // the new subdivision point 
    197202                const Vector3 p = (p1 + p2) * 0.5f; 
     203         
     204                //cout << "tobj " << ray1.mTerminationObject << " " << ray2.mTerminationObject << " " << p1 << " " << p2 << endl; 
     205                //cout << "term " << ray1.mTermination << " " << ray2.mTermination << endl; 
     206 
     207                // cast ray into the new point 
    198208                SimpleRay sray(oldRay.mOrigin, p - oldRay.mOrigin, SamplingStrategy::GVS, 1.0f); 
    199209         
    200                 // cast ray into the new subdivision point 
    201                 VssRay *newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox(), false); 
    202                  
     210                VssRay *newRay = mRayCaster->CastRay(sray, mViewCellsManager->GetViewSpaceBox()); 
     211 
    203212                if (!newRay) return 0; 
    204213 
     
    209218                 
    210219                // subdivide further 
    211                 const int s1 = SubdivideEdge(hitTriangle, p1, p, x, *newRay, oldRay); 
    212                 const int s2 = SubdivideEdge(hitTriangle, p, p2, *newRay, y, oldRay); 
    213                                  
     220                const int samples1 = SubdivideEdge(hitTriangle, p1, p, ray1, *newRay, oldRay); 
     221                const int samples2 = SubdivideEdge(hitTriangle, p, p2, *newRay, ray2, oldRay); 
     222                         
     223                // this ray will not be further processed 
    214224                if (!enqueued) 
    215225                        delete newRay; 
    216226                 
    217                 return s1 + s2 + 1; 
     227                return samples1 + samples2 + 1; 
    218228        } 
    219229} 
     
    222232int GvsPreprocessor::AdaptiveBorderSampling(const VssRay &currentRay) 
    223233{ 
    224         cout << "a"; 
    225234        Intersectable *tObj = currentRay.mTerminationObject; 
    226235        Triangle3 hitTriangle; 
     
    245254        simpleRays.reserve(9); 
    246255 
     256        //cout << "currentRay: " << currentRay.mOrigin << " dir: " << currentRay.GetDir() << endl; 
     257 
    247258        VertexContainer::const_iterator vit, vit_end = enlargedTriangle.end(); 
    248259 
     
    252263                SimpleRay sr(currentRay.GetOrigin(), rayDir, SamplingStrategy::GVS, 1.0f); 
    253264                simpleRays.AddRay(sr); 
    254         } 
    255  
    256         // visualize enlarged triangles 
     265 
     266                //cout << "new: " << sr.mOrigin << " dist: " << sr.mDirection << endl; 
     267        } 
     268 
    257269        if (0) 
    258270        { 
     271                // visualize enlarged triangles 
    259272                VizStruct dummy; 
    260273                dummy.enlargedTriangle = new Polygon3(enlargedTriangle); 
    261274                dummy.originalTriangle = hitTriangle; 
    262                 //dummy.ray = new VssRay(currentRay); 
    263275                vizContainer.push_back(dummy); 
    264276        } 
     
    266278        // cast rays to triangle vertices and determine visibility 
    267279        VssRayContainer vssRays; 
    268         CastRays(simpleRays, vssRays, false, false); 
     280 
     281        // don't cast double rays as we need only the forward rays 
     282        const bool castDoubleRays = false; 
     283        // cannot prune invalid rays because we have to  
     284        // compare adjacent  rays. 
     285        const bool pruneInvalidRays = false; 
     286 
     287        CastRays(simpleRays, vssRays, castDoubleRays, pruneInvalidRays); 
    269288 
    270289        // set flags 
     
    275294        } 
    276295 
    277         // add to ray queue 
     296        // handle rays 
    278297        EnqueueRays(vssRays); 
    279298         
     
    282301 
    283302    // recursivly subdivide each edge 
    284         for (int i = 0; 1 && (i < n); ++ i) 
    285         { 
    286                 castRays += SubdivideEdge( 
    287                         hitTriangle, 
    288                         enlargedTriangle[i],  
    289                         enlargedTriangle[(i + 1) % n],  
    290                         *vssRays[i],  
    291                         *vssRays[(i + 1) % n], 
    292                         currentRay); 
     303        for (int i = 0; i < n; ++ i) 
     304        { 
     305                castRays += SubdivideEdge(hitTriangle, 
     306                                                                  enlargedTriangle[i],  
     307                                                                  enlargedTriangle[(i + 1) % n],  
     308                                                                  *vssRays[i],  
     309                                                                  *vssRays[(i + 1) % n], 
     310                                                                  currentRay); 
    293311        } 
    294312 
    295313        mBorderSamples += castRays; 
     314 
    296315        return castRays; 
    297316} 
    298317 
    299318 
    300 static Vector3 GetPassingPoint(const VssRay &currentRay, 
    301                                                           const Triangle3 &hitTriangle, 
    302                                                            const VssRay &oldRay) 
    303 { 
    304         // intersect triangle plane with plane spanned by current samples 
     319Vector3 GvsPreprocessor::GetPassingPoint(const VssRay &currentRay, 
     320                                                                                const Triangle3 &hitTriangle, 
     321                                                                                 const VssRay &oldRay) const 
     322{ 
     323        //-- intersect triangle plane with plane spanned by current samples 
    305324        Plane3 plane(currentRay.GetOrigin(), currentRay.GetTermination(), oldRay.GetTermination()); 
    306325        Plane3 triPlane(hitTriangle.GetNormal(), hitTriangle.mVertices[0]); 
     
    310329        // Evaluate new hitpoint just outside the triangle 
    311330        const float factor = 0.95f; 
    312         float t = triPlane.FindT(intersectLine); 
     331        const float t = triPlane.FindT(intersectLine); 
    313332        const Vector3 newPoint = intersectLine.mOrigin + t * factor * intersectLine.mDirection; 
    314333 
     
    329348        const Vector3 predicted = CalcPredictedHitPoint(currentRay, hitTriangle, oldRay); 
    330349 
    331         //-- Construct the mutated ray with xnew,dir = predicted(x)- pnew  
    332         //-- as direction vector 
     350        //-- Construct the mutated ray with xnew, 
     351        //-- dir = predicted(x)- pnew as direction vector 
    333352        const Vector3 newDir = predicted - newPoint ; 
     353 
    334354        // take xnew,p = intersect(viewcell, line(pnew, predicted(x)) as origin ? 
    335355        // difficult to say!! 
     
    438458        else if (0) 
    439459        {        
    440                 //-- load view cells from file 
    441460                //-- test successful view cells loading by exporting them again 
    442461                VssRayContainer dummies; 
     
    451470                //////// 
    452471                //-- stats 
     472 
    453473                cout << "\nPass " << mPass << " #samples: " << castSamples << " of " << mTotalSamples << endl; 
    454  
    455                 //mVssRays.PrintStatistics(mStats); 
    456                 mStats  
     474                //mVssRays.PrintStatistics(mGvsStats); 
     475                mGvsStats  
    457476                        << "#Pass\n" << mPass << endl 
    458477                        << "#Time\n" << TimeDiff(startTime, GetTime())*1e-3 << endl 
     
    464483                        << "#GvsRuns\n" << mGvsPass << endl; 
    465484 
    466                 mViewCellsManager->PrintPvsStatistics(mStats); 
     485                mViewCellsManager->PrintPvsStatistics(mGvsStats); 
    467486 
    468487                char str[64]; sprintf(str, "tmp/pass%04d-", mPass); 
     
    489508        } 
    490509 
    491         cout << 2 * castSamples / (1e3f * TimeDiff(startTime, GetTime())) << "M rays/s" << endl; 
     510        cout << "cast " << 2 * castSamples / (1e3f * TimeDiff(startTime, GetTime())) << "M rays/s" << endl; 
    492511        Visualize(); 
    493512 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.h

    r1771 r1932  
    105105        void EnlargeTriangle(VertexContainer &vertices, 
    106106                                                 const Triangle3 &hitTriangle, 
    107                                                  const VssRay &ray); 
     107                                                 const VssRay &ray) const; 
    108108 
    109         int SubdivideEdge( 
    110                 const Triangle3 &hitTriangle, 
    111                 const Vector3 &p1,  
    112                 const Vector3 &p2,  
    113                 const VssRay &x,  
    114                 const VssRay &y, 
    115                 const VssRay &oldRay); 
     109        int SubdivideEdge(const Triangle3 &hitTriangle, 
     110                                          const Vector3 &p1,  
     111                                          const Vector3 &p2,  
     112                                          const VssRay &ray1, 
     113                      const VssRay &ray2, 
     114                                          const VssRay &oldRay); 
    116115 
    117116        void Visualize(); 
     117 
     118        void CreateDisplacedVertices(VertexContainer &vertices, 
     119                                                                 const Triangle3 &hitTriangle, 
     120                                                                 const VssRay &ray,  
     121                                                                 const int index) const; 
     122 
     123        Vector3 CalcPredictedHitPoint(const VssRay &newRay,  
     124                                                                  const Triangle3 &hitTriangle, 
     125                                                                  const VssRay &oldRay) const; 
     126 
     127 
     128        Vector3 GetPassingPoint(const VssRay &currentRay, 
     129                                                        const Triangle3 &hitTriangle, 
     130                                                        const VssRay &oldRay) const; 
    118131 
    119132        ////////////////////// 
     
    134147        /////////// 
    135148        // stats 
     149 
    136150        int mSampleContriPerPass; 
    137151        int mTotalSampleContri; 
     
    139153        int mBorderSamples; 
    140154        int mGvsPass; 
     155 
     156        ofstream mGvsStats; 
    141157}; 
    142158 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Plane3.h

    r1842 r1932  
    2121                 const Vector3 &b, 
    2222                 const Vector3 &c 
    23         ); 
     23                ); 
    2424 
    2525  Plane3(const Vector3 &normal, 
     
    3333  } 
    3434 
    35   float Distance(const Vector3 &v) const { 
    36     return DotProd(v, mNormal) + mD; 
     35  float Distance(const Vector3 &v) const  
     36  { 
     37          return DotProd(v, mNormal) + mD; 
    3738  } 
    3839 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r1931 r1932  
    11331133                                           ) 
    11341134{ 
    1135   const long t1 = GetTime(); 
     1135        const long t1 = GetTime(); 
    11361136 
    11371137        for (int i = 0; i < (int)rays.size();) 
     
    11491149                } 
    11501150                else  
    1151                   { 
     1151                { 
    11521152                        mRayCaster->CastRay( 
    11531153                                                                rays[i], 
     
    11561156                                                                castDoubleRays, 
    11571157                                                                pruneInvalidRays); 
    1158                         i ++; 
    1159                   } 
     1158                        ++ i; 
     1159                } 
    11601160 
    11611161                if (rays.size() > 10000 && i % 10000 == 0) 
     
    11631163        } 
    11641164 
    1165         if (rays.size() > 10000) { 
     1165        if (rays.size() > 10000)  
     1166        { 
    11661167          cout<<endl; 
    11671168         
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r1931 r1932  
    142142 
    143143        virtual void CastRays(SimpleRayContainer &rays, 
    144                 VssRayContainer &vssRays, 
    145                 const bool castDoubleRays, 
    146                 const bool pruneInvalidRays = true); 
     144                                                  VssRayContainer &vssRays, 
     145                                                  const bool castDoubleRays, 
     146                                                  const bool pruneInvalidRays = true); 
    147147 
    148148  /** Compute pixel error of the current PVS solution by sampling given number of viewpoints */ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h

    r1926 r1932  
    100100        void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays); 
    101101 
    102         float 
    103                 GetPixelError(int &pvsSize); 
     102        float GetPixelError(int &pvsSize); 
    104103 
    105104        int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 
     
    109108 
    110109        void SetupProjectionForViewPoint(const Vector3 &viewPoint,  
    111                 const Beam &beam,  
    112                 Intersectable *sourceObject); 
     110                                                                         const Beam &beam,  
     111                                                                         Intersectable *sourceObject); 
    113112 
    114113 
     
    296295        } 
    297296 
    298         // matt: dummy file 
     297        // matt: dummy function, must be provided by bittner 
    299298        void RenderRenderCost() {} 
    300299 
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.cpp

    r1900 r1932  
    2424 
    2525VssRay *RayCaster::CastRay(const SimpleRay &simpleRay, 
    26                                                    const AxisAlignedBox3 &box, 
    27                                                    const bool castDoubleRay) 
     26                                                   const AxisAlignedBox3 &box) 
     27                                                   //const bool castDoubleRay)  
    2828{ 
    29   VssRayContainer rays; 
    30   CastRay(simpleRay, rays, box, castDoubleRay); 
    31    
    32   if (!rays.empty()) 
    33         return rays.back(); 
    34   else 
    35         return NULL; 
     29        // note: make no sense otherwise 
     30        const bool castDoubleRay = false; 
     31        VssRayContainer rays; 
     32        CastRay(simpleRay, rays, box, castDoubleRay); 
     33     
     34        if (!rays.empty()) 
     35                return rays.back(); 
     36        else 
     37                return NULL; 
    3638} 
    3739 
     
    4547                                           Intersection &hit) 
    4648{ 
    47   if (!hit.mObject)  { 
    48         // compute intersection with the scene bounding box 
     49        if (!hit.mObject)   
     50        { 
     51                // compute intersection with the scene bounding box 
    4952#if EXACT_BOX_CLIPPING 
    50         static Ray ray; 
    51         mPreprocessor.SetupRay(ray, origin, direction); 
    52          
    53         float tmin, tmax; 
    54         if (box.ComputeMinMaxT(ray, &tmin, &tmax) && (tmin < tmax)) { 
    55           hit.mPoint = ray.Extrap(tmax); 
     53                static Ray ray; 
     54                mPreprocessor.SetupRay(ray, origin, direction); 
     55 
     56                float tmin, tmax; 
     57                if (box.ComputeMinMaxT(ray, &tmin, &tmax) && (tmin < tmax))  
     58                { 
     59                        hit.mPoint = ray.Extrap(tmax); 
     60                } 
     61                else  
     62                { 
     63                        // cout<<" invalid hp "<<tmin<<" "<<tmax<<endl; 
     64                        // cout<<" box "<<box<<endl; 
     65                        // cout<<" origin "<<origin<<endl; 
     66                        // cout<<" direction "<<direction<<endl; 
     67                        // cout<< "inv dir"<<ray.GetInvDir()<<endl; 
     68                        return false; 
     69                } 
     70#else 
     71                hit.mPoint = origin + direction * Magnitude(box.Diagonal()); 
     72#endif 
    5673        } 
    57         else { 
    58           //            cout<<" invalid hp "<<tmin<<" "<<tmax<<endl; 
    59           //            cout<<" box "<<box<<endl; 
    60           //            cout<<" origin "<<origin<<endl; 
    61           //            cout<<" direction "<<direction<<endl; 
    62           //            cout<< "inv dir"<<ray.GetInvDir()<<endl; 
    63           return false; 
     74        else 
     75        { 
     76                if (mPreprocessor.mDetectEmptyViewSpace)  
     77                { 
     78                        if (DotProd(hit.mNormal, direction) >= -Limits::Small)  
     79                        {        
     80                                hit.mObject = NULL; 
     81                                return false; 
     82                        } 
     83                } 
    6484        } 
    65 #else 
    66         hit.mPoint = origin + direction*Magnitude(box.Diagonal()); 
    67 #endif 
    68   } 
    69   else 
    70         if (mPreprocessor.mDetectEmptyViewSpace) { 
    71           if (DotProd(hit.mNormal, direction) >= -Limits::Small) {       
    72                 hit.mObject = NULL; 
    73                 return false; 
    74           } 
    75         } 
    76    
    77   return true; 
     85 
     86        return true; 
    7887} 
    7988 
     
    98107        //        return 0; 
    99108         
    100         if (pruneInvalidRays) { 
    101           if (!hitA.mObject && !hitB.mObject) { 
    102                 return 0; 
    103           } 
     109        if (pruneInvalidRays)  
     110        { 
     111                if (!hitA.mObject && !hitB.mObject)  
     112                { 
     113                        return 0; 
     114                } 
    104115        } 
    105116         
     
    107118          ValidateRay(simpleRay.mOrigin, simpleRay.mDirection, box, hitA); 
    108119         
    109         const bool validB = castDoubleRay &&  
    110           ValidateRay(simpleRay.mOrigin, -simpleRay.mDirection, box, hitB); 
     120        // note: should we check for backward valitidy also for single rays? 
     121        const bool validB = //castDoubleRay &&  
     122                ValidateRay(simpleRay.mOrigin, -simpleRay.mDirection, box, hitB); 
    111123         
    112124#if DEBUG_RAYCAST 
     
    115127         
    116128        // reset both contributions 
    117         if (!validA || !validB) { 
    118           if (pruneInvalidRays) 
    119                 return 0; 
    120           // reset both contributions of this ray 
    121           hitA.mObject = NULL; 
    122           hitB.mObject = NULL; 
     129        if (!validA || !validB) 
     130        { 
     131                if (pruneInvalidRays) 
     132                        return 0; 
     133                 
     134                // reset both contributions of this ray 
     135                hitA.mObject = NULL; 
     136                hitB.mObject = NULL; 
    123137        } 
    124138           
    125          
    126         const bool validSample = true; 
    127139        // 8.11. 2007 JB 
    128140        // degenerate rays checked by geometrical constraint... 
     
    133145#endif 
    134146 
    135         if (validSample) { 
    136           if (!pruneInvalidRays || hitA.mObject) { 
    137                 VssRay *vssRay = new VssRay( 
    138                                                                         hitB.mPoint, 
     147        if (!pruneInvalidRays || hitA.mObject)  
     148        { 
     149                VssRay *vssRay = new VssRay(hitB.mPoint, 
    139150                                                                        hitA.mPoint, 
    140151                                                                        hitB.mObject, 
    141152                                                                        hitA.mObject, 
    142153                                                                        mPreprocessor.mPass, 
    143                                                                         simpleRay.mPdf 
    144                                                                         ); 
    145                  
     154                                                                        simpleRay.mPdf); 
     155 
    146156                if (validA) 
    147                   vssRay->mFlags |= VssRay::Valid; 
     157                        vssRay->mFlags |= VssRay::Valid; 
     158 
    148159                vssRay->mDistribution = simpleRay.mDistribution; 
    149160                vssRays.push_back(vssRay); 
    150161                ++ hits; 
    151162                //cout << "vssray 1: " << *vssRay << " " << vssRay->mTermination - vssRay->mOrigin << endl; 
    152           } 
    153            
     163        } 
     164 
    154165#if DEBUG_RAYCAST 
    155           Debug<<"PR3"<<flush; 
     166        Debug<<"PR3"<<flush; 
    156167#endif 
    157168 
    158           if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 
    159                 { 
    160                   VssRay *vssRay = new VssRay( 
    161                                                                           hitA.mPoint, 
    162                                                                           hitB.mPoint, 
    163                                                                           hitA.mObject, 
    164                                                                           hitB.mObject, 
    165                                                                           mPreprocessor.mPass, 
    166                                                                           simpleRay.mPdf 
    167                                                                           ); 
    168                   if (validB) 
     169        if (castDoubleRay && (!pruneInvalidRays || hitB.mObject)) 
     170        { 
     171                VssRay *vssRay = new VssRay(hitA.mPoint, 
     172                                                                        hitB.mPoint, 
     173                                                                        hitA.mObject, 
     174                                                                        hitB.mObject, 
     175                                                                        mPreprocessor.mPass, 
     176                                                                        simpleRay.mPdf); 
     177 
     178                if (validB) 
    169179                        vssRay->mFlags |= VssRay::Valid; 
    170                    
    171                   vssRay->mDistribution = simpleRay.mDistribution; 
    172                   vssRays.push_back(vssRay); 
    173                   ++ hits; 
    174                   //cout << "vssray 2: " << *vssRay << endl; 
    175                 } 
     180 
     181                vssRay->mDistribution = simpleRay.mDistribution; 
     182                vssRays.push_back(vssRay); 
     183                ++ hits; 
     184                //cout << "vssray 2: " << *vssRay << endl; 
    176185        } 
    177186         
  • GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h

    r1824 r1932  
    4343                @returns ray or NULL if invalid 
    4444        */ 
    45         VssRay *CastRay( 
    46                 const SimpleRay &simpleRay, 
    47             const AxisAlignedBox3 &box, 
    48                 const bool castDoubleRay 
    49                 ); 
     45        VssRay *CastRay(const SimpleRay &simpleRay, 
     46                                        const AxisAlignedBox3 &box); 
     47                                        //const bool castDoubleRay); 
    5048 
    51         virtual int CastRay( 
    52                 const SimpleRay &simpleRay, 
    53         VssRayContainer &vssRays, 
    54                 const AxisAlignedBox3 &box, 
    55                 const bool castDoubleRay, 
    56                 const bool pruneInvalidRays = true 
    57                 ) = 0; 
     49        virtual int CastRay(const SimpleRay &simpleRay, 
     50                                                VssRayContainer &vssRays, 
     51                                                const AxisAlignedBox3 &box, 
     52                                                const bool castDoubleRay, 
     53                                                const bool pruneInvalidRays = true 
     54                                                ) = 0; 
    5855 
    59          virtual void CastRays16( 
    60                  const int i, 
    61                  SimpleRayContainer &rays,  
    62                  VssRayContainer &vssRays, 
    63                  const AxisAlignedBox3 &sbox, 
    64                  const bool castDoubleRay, 
    65                  const bool pruneInvalidRays = true 
    66                  ) = 0; 
     56         virtual void CastRays16(const int i, 
     57                                                         SimpleRayContainer &rays, 
     58                                                         VssRayContainer &vssRays, 
     59                                                         const AxisAlignedBox3 &sbox, 
     60                                                         const bool castDoubleRay, 
     61                                                         const bool pruneInvalidRays = true 
     62                                                         ) = 0; 
    6763         
    6864 
     
    8682 
    8783 
    88         int ProcessRay( 
    89                          const SimpleRay &ray, 
    90                          Intersection &hitA, 
    91                          Intersection &hitB, 
    92                          VssRayContainer &vssRays, 
    93                          const AxisAlignedBox3 &box, 
    94                          const bool castDoubleRay, 
    95                          const bool pruneInvalidRays = true 
    96                          ); 
     84        int ProcessRay(const SimpleRay &ray, 
     85                                   Intersection &hitA, 
     86                                   Intersection &hitB, 
     87                                   VssRayContainer &vssRays, 
     88                                   const AxisAlignedBox3 &box, 
     89                                   const bool castDoubleRay, 
     90                                   const bool pruneInvalidRays = true); 
    9791 
    9892        /** Checks if ray is valid. 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp

    r1867 r1932  
    185185} 
    186186 
    187 } 
     187 
     188bool Triangle3::IntersectPlane(const Plane3 &plane,  
     189                                                           Vector3 &intersectA,  
     190                                                           Vector3 &intersectB) const 
     191{ 
     192        int side[3]; 
     193 
     194        // compute distance from plane 
     195        for (int i = 0; i < 3; ++ i) 
     196        { 
     197                side[i] = plane.Side(mVertices[i], Limits::Small); 
     198        } 
     199 
     200        ///// 
     201        // no intersection => early exit 
     202        if (((side[0] > 0) && (side[1] > 0) && (side[2] > 0)) || 
     203                ((side[0] < 0) && (side[1] < 0) && (side[2] < 0))) 
     204        { 
     205                return false; 
     206        } 
     207 
     208        ///////////// 
     209        // at least 2 triangle vertices lie in plane => early exit 
     210 
     211        for (int i = 0; i < 3; ++ i) 
     212        { 
     213                if (!side[i] && !side[(i + 1) % 3]) 
     214                { 
     215                        intersectA = mVertices[i]; 
     216                        intersectB = mVertices[(i + 1) % 3]; 
     217 
     218                        return true; 
     219                } 
     220        } 
     221 
     222        bool foundA = false; 
     223 
     224        // compute intersection points 
     225        for (int i = 0; i < 3; ++ i) 
     226        { 
     227                const int i_2 = (i + 1) % 3; 
     228 
     229                // intersection found 
     230                if ((side[i] >= 0) && (side[i_2] <= 0)) 
     231                {        
     232                        const float t = plane.FindT(mVertices[i], mVertices[i_2]); 
     233                         
     234                        if (!foundA) 
     235                        { 
     236                                intersectA = mVertices[i] + t * (mVertices[i_2] - mVertices[i]); 
     237                                foundA = true; 
     238                        } 
     239                        else 
     240                        { 
     241                                intersectB = mVertices[i] + t * (mVertices[i_2] - mVertices[i]); 
     242                                return true; 
     243                        } 
     244                } 
     245        } 
     246 
     247        cout << "warning! wrong triangle - plane intersection" << endl; 
     248        return false; // something went wrong! 
     249} 
     250 
     251 
     252} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.h

    r1420 r1932  
    99class AxisAlignedBox3; 
    1010class Ray; 
    11  
     11class Plane3; 
    1212 
    1313struct Triangle3  
     
    3232        int CastRay(const Ray &ray, float &t, const float nearestT, Vector3 &normal) const; 
    3333 
    34          friend ostream& operator<< (ostream &s, const Triangle3 &A); 
    35          friend istream& operator>> (istream &s, Triangle3 &A); 
     34        friend ostream& operator<< (ostream &s, const Triangle3 &A); 
     35        friend istream& operator>> (istream &s, Triangle3 &A); 
    3636 
    37          /** Checks if this triangle is ill-defined. 
    38          */ 
    39          bool CheckValidity() const; 
     37        /** Checks if this triangle is ill-defined. 
     38        */ 
     39        bool CheckValidity() const; 
    4040 
    41          ////////////////////////////// 
    42          /// the triangle vertices 
    43          Vector3 mVertices[3]; 
     41        /** Intersects triangle with plane, returns intersection points 
     42                if intersection is happening. 
     43 
     44                @returns true if triangle intersects plane 
     45        */ 
     46        bool IntersectPlane(const Plane3 &plane, Vector3 &intersectA, Vector3 &intersectB) const; 
     47 
     48        /////////////////// 
     49 
     50        /// the triangle vertices 
     51        Vector3 mVertices[3]; 
    4452}; 
    4553 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1931 r1932  
    3434#define AVG_RAY_CONTRIBUTIONS 1 
    3535#define CONTRIBUTION_RELATIVE_TO_PVS_SIZE 1 
     36#define PVS_ADD_DIRTY 1 
    3637 
    3738namespace GtpVisibilityPreprocessor { 
     
    8283 
    8384 
    84 int ViewCellsManager::CastPassSamples2(const int samplesPerPass, VssRayContainer &passSamples) const 
     85int ViewCellsManager::CastPassSamples2(const int samplesPerPass,  
     86                                                                           VssRayContainer &passSamples) const 
    8587{ 
    8688        long startTime = GetTime(); 
     
    21532155 
    21542156 
    2155  
    2156 #define PVS_ADD_DIRTY 1 
     2157inline static void AddSampleToPvs(ObjectPvs &pvs,  
     2158                                                                  Intersectable *obj,  
     2159                                                                  const float pdf) 
     2160{ 
     2161#if PVS_ADD_DIRTY 
     2162        pvs.AddSampleDirtyCheck(obj, pdf); 
     2163 
     2164        if (pvs.RequiresResort())  
     2165        { 
     2166                pvs.SimpleSort(); 
     2167        } 
     2168#else 
     2169        pvs.AddSample(obj, pdf); 
     2170#endif 
     2171} 
     2172 
     2173 
     2174void ViewCellsManager::ComputeViewCellContribution(ViewCell *viewCell, 
     2175                                                                                                   VssRay &ray,  
     2176                                                                                                   Intersectable *obj, 
     2177                                                                                                   const Vector3 &pt, 
     2178                                                                                                   const bool addRays) 
     2179{ 
     2180        // check if we are outside of view space 
     2181        if (!obj || !viewCell->GetValid()) 
     2182                return; 
     2183 
     2184        // if ray not outside of view space 
     2185        float relContribution = 0.0f; 
     2186        float absContribution = 0.0f; 
     2187 
     2188        // todo: maybe not correct for kd node pvs 
     2189        if (viewCell->GetPvs().GetSampleContribution(obj, 
     2190                                                                                                 ray.mPdf, 
     2191                                                                                                 relContribution)) 
     2192        { 
     2193                absContribution = 1.0f; 
     2194        } 
     2195         
     2196        // $$ clear the relative contribution as it is currently not correct anyway 
     2197        relContribution = 0.0f; 
     2198 
     2199        if (absContribution == 1.0f) 
     2200        { 
     2201                ++ ray.mPvsContribution; 
     2202                relContribution = 1.0f; 
     2203 
     2204                if (addRays)  
     2205                { 
     2206                        AddSampleToPvs(viewCell->GetPvs(), obj, ray.mPdf); 
     2207                } 
     2208 
     2209#if DIST_WEIGHTED_CONTRIBUTION  
     2210                // recalculate the contribution - weight the 1.0f contribution by the sqr distance to the 
     2211                // object-> a new contribution in the proximity of the viewcell has a larger weight! 
     2212                relContribution /= SqrDistance(GetViewCellBox(viewcell).Center(), pt); 
     2213                                   
     2214#endif 
     2215        } 
     2216 
     2217#if SUM_RAY_CONTRIBUTIONS || AVG_RAY_CONTRIBUTIONS 
     2218        ray.mRelativePvsContribution += relContribution; 
     2219#else 
     2220        // recalculate relative contribution - use max of AbsContribution 
     2221        if (ray.mRelativePvsContribution < absContribution) 
     2222                ray.mRelativePvsContribution = absContribution; 
     2223#endif 
     2224} 
     2225 
    21572226 
    21582227float 
     
    21642233        ray.mRelativePvsContribution = 0.0f; 
    21652234 
    2166         if (ray.mTerminationObject==NULL) 
     2235        if (!ray.mTerminationObject) 
    21672236                return 0.0f; 
    21682237 
    2169         ViewCellContainer viewcells; 
     2238        ViewCellContainer viewCells; 
    21702239 
    21712240        static Ray hray; 
     
    21832252 
    21842253        // traverse the view space subdivision 
    2185         CastLineSegment(origin, termination, viewcells); 
     2254        CastLineSegment(origin, termination, viewCells); 
    21862255 
    21872256        if (storeViewCells) 
    21882257        {        
    21892258                // copy viewcells memory efficiently 
    2190                 ray.mViewCells.reserve(viewcells.size()); 
    2191                 ray.mViewCells = viewcells; 
    2192         } 
    2193  
    2194         ViewCellContainer::const_iterator it = viewcells.begin(); 
    2195  
     2259                ray.mViewCells.reserve(viewCells.size()); 
     2260                ray.mViewCells = viewCells; 
     2261        } 
     2262 
     2263        // optain pvs entry (can be different from hit object) 
    21962264        Intersectable *terminationObj = GetIntersectable(ray, true); 
    21972265 
    2198          
    2199         for (; it != viewcells.end(); ++ it)  
    2200         { 
    2201                 ViewCell *viewcell = *it; 
    2202  
    2203                 if (viewcell->GetValid()) 
    2204                 {        
    2205                         // if ray not outside of view space 
    2206                         float relContribution = 0.0f; 
    2207                         float absContribution = 0.0f; 
    2208                          
    2209                         if (terminationObj)  
    2210                         { 
    2211                                 // todo: maybe not correct for kd node pvs 
    2212                           if (viewcell->GetPvs().GetSampleContribution( 
    2213                                                                                                                    terminationObj, 
    2214                                                                                                                    ray.mPdf, 
    2215                                                                                                                    relContribution)) 
    2216                                 absContribution = 1.0f; 
    2217                            
    2218                           // $$ clear the relative contribution as it is currently not correct anyway 
    2219                           relContribution = 0.0f; 
    2220  
    2221                           if (absContribution == 1.0f) 
    2222                                 { 
    2223                                   ++ ray.mPvsContribution; 
    2224                                   relContribution = 1.0f; 
    2225                                   if (addRays) { 
    2226 #if PVS_ADD_DIRTY 
    2227                                         viewcell->GetPvs().AddSampleDirtyCheck(terminationObj, ray.mPdf); 
    2228                                         if (viewcell->GetPvs().RequiresResort()) { 
    2229                                           viewcell->GetPvs().SimpleSort(); 
    2230                                         } 
    2231 #else 
    2232                                         viewcell->GetPvs().AddSample(terminationObj, ray.mPdf); 
    2233 #endif 
    2234                                   } 
    2235  
    2236 #if CONTRIBUTION_RELATIVE_TO_PVS_SIZE 
    2237                                   relContribution /= viewcell->GetPvs().GetSize(); 
    2238 #endif 
    2239                                    
    2240 #if DIST_WEIGHTED_CONTRIBUTION  
    2241                                   // recalculate the contribution - weight the 1.0f contribution by the sqr distance to the 
    2242                                   // object-> a new contribution in the proximity of the viewcell has a larger weight! 
    2243                                   relContribution /= SqrDistance(GetViewCellBox(viewcell).Center(), 
    2244                                                                                                  ray.mTermination); 
    2245                                    
    2246 #endif 
    2247                                 } 
    2248 #if SUM_RAY_CONTRIBUTIONS || AVG_RAY_CONTRIBUTIONS 
    2249                           ray.mRelativePvsContribution += relContribution; 
    2250 #else 
    2251                           // recalculate relative contribution - use max of AbsContribution 
    2252                           if (ray.mRelativePvsContribution < absContribution) 
    2253                                 ray.mRelativePvsContribution = absContribution; 
    2254 #endif 
    2255                         } 
    2256                 } 
     2266        ViewCellContainer::const_iterator it = viewCells.begin(); 
     2267 
     2268        for (; it != viewCells.end(); ++ it)  
     2269        { 
     2270                ComputeViewCellContribution(*it,  
     2271                                                                        ray,  
     2272                                                                        terminationObj,  
     2273                                                                        ray.mTermination,  
     2274                                                                        addRays); 
    22572275        } 
    22582276 
    22592277#if AVG_RAY_CONTRIBUTIONS 
    2260         ray.mRelativePvsContribution /= viewcells.size(); 
     2278        ray.mRelativePvsContribution /= (float)viewCells.size(); 
    22612279#endif 
    22622280#if USE_RAY_LENGTH_AS_CONTRIBUTION 
    2263   float c = 0.0f; 
    2264   if (terminationObj)  
    2265         c = ray.Length(); 
    2266   ray.mRelativePvsContribution = ray.mPvsContribution = c; 
    2267   return c; 
     2281        float c = 0.0f; 
     2282        if (obj)  
     2283                c = ray.Length(); 
     2284        ray.mRelativePvsContribution = ray.mPvsContribution = c; 
     2285        return c; 
    22682286#else 
    2269   return ABS_CONTRIBUTION_WEIGHT*ray.mPvsContribution + 
    2270         (1.0f - ABS_CONTRIBUTION_WEIGHT)*ray.mRelativePvsContribution; 
     2287        return ABS_CONTRIBUTION_WEIGHT * ray.mPvsContribution + 
     2288                (1.0f - ABS_CONTRIBUTION_WEIGHT) * ray.mRelativePvsContribution; 
    22712289#endif 
    22722290} 
    2273  
    22742291 
    22752292 
     
    35443561                                if (p < raysOut) 
    35453562                                { 
    3546                                         if ((*rit)->mFlags & VssRay::BorderSample) 
     3563                                        if (0 && (*rit)->mFlags & VssRay::BorderSample) 
    35473564                                        { 
    3548                                                 cout << "b"; 
    35493565                                                vcRays.push_back(*rit); 
    35503566                                        } 
    35513567                                        else if ((*rit)->mFlags & VssRay::ReverseSample) 
    35523568                                        { 
     3569                                                cout << "l"; 
    35533570                                                vcRays2.push_back(*rit); 
    3554                                                 cout << "r"; 
    35553571                                        } 
    3556                                         else 
     3572                                        else if(0) 
    35573573                                        { 
    3558                                                 cout << "n"; 
    35593574                                                vcRays3.push_back(*rit); 
    35603575                                        }        
     
    54485463 
    54495464        if (0) 
    5450         {       // real meshes are constructed at this stage 
     5465        {        
     5466                // real meshes are constructed at this stage 
    54515467                cout << "finalizing view cells ... "; 
    5452                 FinalizeViewCells(true); 
     5468        FinalizeViewCells(true); 
    54535469                cout << "finished" << endl; 
    54545470        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r1920 r1932  
    486486                        a mesh is created representing the geometry 
    487487                @param bconverter a conversion routine working with the similarities of bounding 
    488                 boxes: if there is a certain similarity of overlap between bounding boxes, two tested 
     488                        boxes: if there is a certain similarity of overlap between  
     489                        bounding boxes, two tested 
    489490                candidate objects are considered to be the same objects 
    490491                @returns the view cells manager if loading was successful, false otherwise 
     
    501502        // TODO: write own visibiltiy filter class 
    502503  void ApplyFilter(KdTree *kdTree, 
    503                                         const float viewSpaceFilterSize, 
    504                                         const float spatialFilterSize); 
     504                                  const float viewSpaceFilterSize, 
     505                                  const float spatialFilterSize); 
    505506 
    506507  // new adaptive version of the filter 
    507508  PvsFilterStatistics  
    508509  ApplyFilter2(ViewCell *viewCell, 
    509                                                          const bool useViewSpaceFilter, 
    510                                                          const float filterSize, 
    511                                                          ObjectPvs &pvs, 
    512                                                          vector<AxisAlignedBox3> *filteredBoxes = NULL 
    513                                                          ); 
     510                           const bool useViewSpaceFilter, 
     511                           const float filterSize, 
     512                           ObjectPvs &pvs, 
     513                           vector<AxisAlignedBox3> *filteredBoxes = NULL); 
    514514 
    515515        void ApplySpatialFilter(KdTree *kdTree, 
     
    560560                                                                           VssRayContainer *visRays = NULL) = NULL; 
    561561 
    562          
     562 
    563563        void ViewCellsManager::ResetPvs(); 
    564    
    565   Preprocessor *GetPreprocessor() const { 
    566         return mPreprocessor; 
    567   } 
    568  
    569   void SetPreprocessor(Preprocessor *p) { 
    570         mPreprocessor = p; 
    571   } 
    572  
    573   void UpdatePvsForEvaluation(); 
     564 
     565        Preprocessor *GetPreprocessor() const { 
     566                return mPreprocessor; 
     567        } 
     568 
     569        void SetPreprocessor(Preprocessor *p) { 
     570                mPreprocessor = p; 
     571        } 
     572 
     573        void UpdatePvsForEvaluation(); 
    574574 
    575575protected: 
     576 
     577        void ComputeViewCellContribution(ViewCell *viewCell, 
     578                                                                         VssRay &ray,  
     579                                                                         Intersectable *obj, 
     580                                                                         const Vector3 &pt, 
     581                                                                         const bool addRays); 
    576582 
    577583        void MergeViewCellsRecursivly(ObjectPvs &pvs,  
     
    581587 
    582588        /** Intersects box with the tree and returns the number of intersected boxes. 
    583                 @returns number of view cells found 
     589        @returns number of view cells found 
    584590        */ 
    585591        virtual int ComputeBoxIntersections(const AxisAlignedBox3 &box,  
     
    618624        */ 
    619625        void ResetViewCells(); 
    620          
     626 
    621627        /** Sets this view cell to active. 
    622628        */ 
     
    626632        */ 
    627633        virtual void CollectViewCells() = 0; 
    628          
     634 
    629635        /** Evaluates view cells statistics and stores it in 
    630                 mViewCellsStatistics. 
     636        mViewCellsStatistics. 
    631637        */ 
    632638        void EvaluateViewCellsStats(); 
    633639 
    634          
     640 
    635641        /////////////////////// 
    636642        //-- helper functions for view cell visualization 
     
    641647                                                           const AxisAlignedBox3 *box, 
    642648                                                           const bool colorCode, 
    643                                                            const AxisAlignedPlane *clipPlane 
    644                                                            ) const; 
     649                                                           const AxisAlignedPlane *clipPlane) const; 
    645650 
    646651        /** Sets exporter color. 
     
    649654                                                         ViewCell *vc,  
    650655                                                         const bool colorCode) const; 
    651          
     656 
    652657        /** Creates meshes from the view cells. 
    653658        */ 
    654659        void CreateViewCellMeshes(); 
    655660 
    656     /** Creates clip plane for visualization. 
     661        /** Creates clip plane for visualization. 
    657662        */ 
    658663        void CreateClipPlane(); 
    659664 
    660665        AxisAlignedPlane *GetClipPlane(); 
    661          
     666 
    662667        void ExportMergedViewCells(const ObjectContainer &objects); 
    663668 
     
    673678        */ 
    674679        ViewCell *ConstructLocalMergeTree(ViewCell *currentViewCell,  
    675                                                                           const ViewCellContainer &viewCells); 
     680                const ViewCellContainer &viewCells); 
    676681 
    677682        /** Constructs local view cell merge hierarchy based solely on similarity with the 
    678                 current viewcell 
     683        current viewcell 
    679684        */ 
    680685        ViewCell *ConstructLocalMergeTree2(ViewCell *currentViewCell,  
  • GTP/trunk/Lib/Vis/Preprocessing/src/VssRay.cpp

    r1824 r1932  
    357357{ 
    358358  VssRayContainer::const_iterator it = begin(); 
    359   //  ofstream s("contrib.log"); 
    360   for (; it != end(); it++) { 
    361         VssRay *ray = *it; 
    362         //      s<<"(pass="<<ray->mPass<<", c="<<ray->mPvsContribution<<")"<<endl; 
    363         if (ray->mPass >= minPass && ray->mPvsContribution > 0) 
    364           selected.push_back(ray); 
    365   } 
     359 
     360  // ofstream s("contrib.log"); 
     361 
     362  for (; it != end(); it++)  
     363  { 
     364          VssRay *ray = *it; 
     365 
     366          // s<<"(pass="<<ray->mPass<<", c="<<ray->mPvsContribution<<")"<<endl; 
     367          if (ray->mPass >= minPass && ray->mPvsContribution > 0) 
     368                  selected.push_back(ray); 
     369  } 
     370 
    366371  return (int)selected.size(); 
    367372} 
Note: See TracChangeset for help on using the changeset viewer.