Changeset 2094


Ignore:
Timestamp:
02/05/07 16:45:46 (17 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
4 edited

Legend:

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

    r2093 r2094  
    2222#include "BvHierarchy.h" 
    2323#include "ViewCell.h" 
     24#include "TraversalTree.h" 
    2425 
    2526 
     
    2829 
    2930#define USE_FIXEDPOINT_T 0 
    30  
    3131#define STUPID_METHOD 0 
    3232 
     
    4141mObjectSpaceSubdivisionType(objectSpaceSubdivisionType), 
    4242mOspTree(NULL),  
    43 mBvHierarchy(NULL) 
     43mBvHierarchy(NULL), 
     44mTraversalTree(NULL) 
    4445{ 
    4546        switch(mObjectSpaceSubdivisionType) 
     
    396397                mBvHierarchy->SetUniqueNodeIds(); 
    397398        } 
     399 
     400        if (0) CreateTraversalTree(); 
    398401} 
    399402 
     
    24832486void HierarchyManager::CreateTraversalTree() 
    24842487{ 
    2485 } 
    2486  
    2487  
    2488 } 
     2488        mTraversalTree = new TraversalTree; 
     2489 
     2490        ViewCellContainer viewCells; 
     2491 
     2492        // add mesh instances of the scene graph to the root of the tree 
     2493        TraversalLeaf *root = (TraversalLeaf *)mTraversalTree->GetRoot(); 
     2494 
     2495        //mVspTree->CollectViewCells(root->mViewCells, false); 
     2496         
     2497        const long startTime = GetTime(); 
     2498        cout << "building traversal tree ... " << endl; 
     2499 
     2500        mTraversalTree->Construct(); 
     2501 
     2502        cout << "finished kd tree construction in " << TimeDiff(startTime, GetTime()) * 1e-3  
     2503                 << " secs " << endl; 
     2504} 
     2505 
     2506 
     2507int HierarchyManager::CastLineSegment(const Vector3 &origin, 
     2508                                                                          const Vector3 &termination, 
     2509                                                                          ViewCellContainer &viewcells, 
     2510                                                                          const bool useMailboxing) 
     2511{ 
     2512        if (!mTraversalTree) 
     2513                return mVspTree->CastLineSegment(origin,termination, viewcells, useMailboxing); 
     2514        else 
     2515                return mTraversalTree->CastLineSegment(origin,termination, viewcells, useMailboxing); 
     2516} 
     2517 
     2518 
     2519} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r2073 r2094  
    4242class Exporter; 
    4343class ViewCellsParseHandlers; 
     44class TraversalTree; 
     45 
    4446 
    4547 
     
    305307 
    306308 
     309        /** Casts line segment into the view cells tree. 
     310                @param origin the origin of the line segment 
     311                @param termination the end point of the line segment 
     312                @returns view cells intersecting the line segment. 
     313        */ 
     314    int CastLineSegment(const Vector3 &origin, 
     315                                                const Vector3 &termination, 
     316                                                ViewCellContainer &viewcells, 
     317                                                const bool useMailboxing = true); 
     318         
    307319protected: 
    308320 
     
    351363        */ 
    352364        void RunConstruction(const bool repairQueue); 
    353                  
     365         
     366         
    354367        //////////////////////////////////////////////// 
    355368 
     
    651664        bool mConsiderMemory; 
    652665 
     666        TraversalTree *mTraversalTree; 
     667 
    653668        int mMaxRepairs; 
    654669 
  • GTP/trunk/Lib/Vis/Preprocessing/src/TraversalTree.cpp

    r2093 r2094  
    152152 
    153153        mBox.Initialize(); 
     154 
    154155        ObjectContainer::const_iterator mi; 
    155156        for ( mi = leaf->mObjects.begin(); mi != leaf->mObjects.end(); ++ mi)  
    156157        { 
    157                 //      cout<<(*mi)->GetBox()<<endl; 
    158158                mBox.Include((*mi)->GetBox()); 
    159159        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r2093 r2094  
    10631063                { 
    10641064                        // create the meshes and compute volumes 
    1065                         vm->FinalizeViewCells(false); 
    1066                         // vm->mViewCellsTree->AssignRandomColors(); 
    1067                 } 
    1068  
    1069                 if (0) 
    1070                 { 
    1071                         cout << "=============== " << vm->GetViewCellById(5318)->GetPvs().GetSize() << "========" << endl; 
     1065                        const bool createMeshes = true; 
     1066                        //const bool createMeshes = false; 
     1067 
     1068                        vm->FinalizeViewCells(createMeshes); 
    10721069                } 
    10731070 
     
    27782775        if (lastVssRay == NULL || 
    27792776                !(ray.mOrigin == lastVssRay->mTermination) || 
    2780                 !(ray.mTermination == lastVssRay->mOrigin)) { 
    2781           viewCells.clear(); 
    2782           // traverse the view space subdivision 
    2783           CastLineSegment(origin, termination, viewCells); 
    2784           lastVssRay = &ray; 
     2777                !(ray.mTermination == lastVssRay->mOrigin))  
     2778        { 
     2779                viewCells.clear(); 
     2780                 
     2781                // traverse the view space subdivision 
     2782                CastLineSegment(origin, termination, viewCells); 
     2783                lastVssRay = &ray; 
    27852784        } 
    27862785         
     
    65566555                                                                                        ViewCellContainer &viewcells) 
    65576556{ 
    6558         return mHierarchyManager-> 
    6559                 GetVspTree()->CastLineSegment(origin, termination, viewcells); 
     6557        return mHierarchyManager->CastLineSegment(origin, termination, viewcells); 
    65606558} 
    65616559 
Note: See TracChangeset for help on using the changeset viewer.