Changeset 904


Ignore:
Timestamp:
05/05/06 11:09:03 (18 years ago)
Author:
bittner
Message:

visibility filter updates

Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
8 edited

Legend:

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

    r878 r904  
    16871687                                   "preprocessor_apply_filter", 
    16881688                                   "true"); 
     1689         
     1690        RegisterOption("Preprocessor.applyVisibilitySpatialFilter", 
     1691                                   optBool, 
     1692                                   "preprocessor_apply_spatial_filter", 
     1693                                   "true"); 
    16891694 
    16901695        RegisterOption("Preprocessor.visibilityFilterWidth", 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r884 r904  
    725725  PrVs prvs; 
    726726  //  mViewCellsManager->SetMaxFilterSize(1); 
    727   mViewCellsManager->GetPrVS(mViewPoint, prvs); 
     727  mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 
    728728  viewcell = prvs.mViewCell; 
    729729   
     
    851851  } else { 
    852852        //  mViewCellsManager->SetMaxFilterSize(1); 
    853         mViewCellsManager->GetPrVS(mViewPoint, prvs); 
     853        mViewCellsManager->GetPrVS(mViewPoint, prvs, mViewCellsManager->GetFilterWidth()); 
    854854        viewcell = prvs.mViewCell; 
    855855  } 
     
    863863                                                                                        mSpatialFilterSize* 
    864864                                                                                        Magnitude(mViewCellsManager->GetViewSpaceBox().Size()), 
    865                                                                                         //                                                                                      mViewCellsManager->GetFilterWidth()/2, 
    866865                                                                                        pvs); 
    867866        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/KdTree.cpp

    r882 r904  
    746746      for (int j=0; j < leaf->mObjects.size(); j++) { 
    747747                Intersectable *object = leaf->mObjects[j]; 
    748                 if (!object->Mailed()) { 
     748                if (!object->Mailed() && Overlap(box, object->GetBox())) { 
    749749                  object->Mail(); 
    750750                  objects.push_back(object); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp

    r878 r904  
    133133        mVisibilityFileName = buffer; 
    134134        environment->GetBoolValue("Preprocessor.applyVisibilityFilter", mApplyVisibilityFilter ); 
     135        environment->GetBoolValue("Preprocessor.applyVisibilitySpatialFilter", 
     136                                                          mApplyVisibilitySpatialFilter ); 
    135137        environment->GetFloatValue("Preprocessor.visibilityFilterWidth", mVisibilityFilterWidth); 
    136138 
     
    273275{ 
    274276   
    275   if (mApplyVisibilityFilter) { 
     277  if (mApplyVisibilityFilter || mApplyVisibilitySpatialFilter) { 
    276278        cout<<"Applying visibility filter..."; 
    277279        cout<<"filyter width = "<<mVisibilityFilterWidth<<endl; 
    278  
     280         
    279281        mViewCellsManager->ApplyFilter(mKdTree, 
    280                                                                    mVisibilityFilterWidth, 
    281                                                                    mVisibilityFilterWidth); 
     282                                                                   mApplyVisibilityFilter ? mVisibilityFilterWidth : -1.0f, 
     283                                                                   mApplyVisibilitySpatialFilter ? mVisibilityFilterWidth : -1.0f); 
    282284        cout<<"done."; 
    283285  } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h

    r878 r904  
    171171   
    172172  bool mApplyVisibilityFilter; 
     173  bool mApplyVisibilitySpatialFilter; 
    173174 
    174175  float mVisibilityFilterWidth; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r884 r904  
    10821082 
    10831083 
    1084 void ViewCellsManager::GetPrVS(const Vector3 &viewPoint, PrVs &prvs) 
    1085 { 
    1086   const AxisAlignedBox3 box = GetFilterBBox(viewPoint, mFilterWidth); 
     1084void ViewCellsManager::GetPrVS(const Vector3 &viewPoint, 
     1085                                                           PrVs &prvs, 
     1086                                                           const float filterWidth) 
     1087{ 
     1088  const AxisAlignedBox3 box = GetFilterBBox(viewPoint, filterWidth); 
    10871089         
    10881090  ViewCell *currentViewCell = GetViewCell(viewPoint); 
     
    49174919  //  AxisAlignedBox3 box(center - Vector3(viewSpaceFilterSize/2), 
    49184920  //                                      center + Vector3(viewSpaceFilterSize/2)); 
     4921 
     4922  if (viewSpaceFilterSize >=0.0f) { 
     4923 
     4924  bool usePrVS = false; 
     4925 
    49194926   
    4920   AxisAlignedBox3 box = GetViewCellBox(viewCell); 
    4921   box.Enlarge(Vector3(viewSpaceFilterSize/2)); 
     4927  if (!usePrVS) { 
     4928        AxisAlignedBox3 box = GetViewCellBox(viewCell); 
     4929        box.Enlarge(Vector3(viewSpaceFilterSize/2)); 
     4930         
     4931        ViewCellContainer viewCells; 
     4932        ComputeBoxIntersections(box, viewCells); 
     4933         
     4934  //  cout<<"box="<<box<<endl; 
     4935        ViewCellContainer::const_iterator it=viewCells.begin(), it_end = viewCells.end(); 
     4936         
     4937        int i; 
     4938        for (i=0; it != it_end; ++it, i++) { 
     4939          //    cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 
     4940          pvs.Merge((*it)->GetPvs()); 
     4941        } 
     4942  } else { 
     4943        PrVs prvs; 
     4944        AxisAlignedBox3 box = GetViewCellBox(viewCell); 
     4945 
     4946        //  mViewCellsManager->SetMaxFilterSize(1); 
     4947        GetPrVS(box.Center(), prvs, viewSpaceFilterSize); 
     4948        pvs = prvs.mViewCell->GetPvs(); 
     4949        DeleteLocalMergeTree(prvs.mViewCell); 
     4950  } 
     4951  } else 
     4952        pvs = viewCell->GetPvs(); 
    49224953   
    4923   ViewCellContainer viewCells; 
    4924   ComputeBoxIntersections(box, viewCells); 
    4925  
    4926   //  cout<<"box="<<box<<endl; 
    4927   ViewCellContainer::const_iterator it=viewCells.begin(), it_end = viewCells.end(); 
    4928    
    4929   int i; 
    4930   for (i=0; it != it_end; ++it, i++) { 
    4931         //      cout<<"v"<<i<<" pvs="<<(*it)->GetPvs().mEntries.size()<<endl; 
    4932         pvs.Merge((*it)->GetPvs()); 
    4933   } 
    4934    
    4935   ApplySpatialFilter(kdTree, spatialFilterSize, pvs); 
     4954  if (spatialFilterSize >=0.0f) 
     4955        ApplySpatialFilter(kdTree, spatialFilterSize, pvs); 
     4956 
    49364957} 
    49374958 
     
    49684989        pvs.Clear(); 
    49694990        pvs = newPvs[i]; 
     4991        newPvs[i].Clear(); 
    49704992  } 
    49714993   
     4994  delete newPvs; 
    49724995} 
    49734996 
     
    49895012        const AxisAlignedBox3 tbox = GetFilterBBox(viewPoint, mFilterWidth); 
    49905013 
    4991                 GetPrVS(viewPoint, testPrVs); 
     5014                GetPrVS(viewPoint, testPrVs, GetFilterWidth()); 
    49925015 
    49935016                exporter->SetWireframe(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h

    r884 r904  
    233233        virtual void GetPvsStatistics(PvsStatistics &stat); 
    234234 
    235         virtual void GetPrVS(const Vector3 &viewPoint, PrVs &prvs); 
     235        virtual void GetPrVS(const Vector3 &viewPoint, PrVs &prvs, const float filterWidth); 
    236236   
    237237        /** Get a viewcell containing the specified point  
     
    455455 
    456456  float GetFilterWidth() { 
     457        return mFilterWidth; 
     458  } 
     459 
     460  float GetAbsFilterWidth() { 
    457461        return Magnitude(mViewSpaceBox.Size())*mFilterWidth; 
    458462  } 
    459    
     463 
    460464protected: 
    461465    void 
  • GTP/trunk/Lib/Vis/Preprocessing/src/default.env

    r884 r904  
    99#       filename vienna.x3d 
    1010# filename ../data/vienna/vienna-simple.x3d 
    11 filename ../data/vienna/vienna-buildings.x3d 
     11#filename ../data/vienna/vienna-buildings.x3d 
    1212#filename ../data/vienna/city1500_flat_1.x3d 
    1313#filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-plane.x3d;../data/vienna/vienna-roads.x3d 
     
    1515#filename ../data/atlanta/atlanta2.x3d 
    1616#filename ../data/soda/soda.dat 
    17 #filename ../data/soda/soda5.dat 
     17filename ../data/soda/soda5.dat 
    1818#filename ../data/PowerPlant/ppsection1/part_a/g0.ply 
    1919#filename ../data/PowerPlant/ppsection1/part_b/g0.ply 
     
    4040        quitOnFinish false 
    4141        computeVisibility true 
    42         applyVisibilityFilter   true 
     42        applyVisibilityFilter   false 
     43        applyVisibilitySpatialFilter    true 
    4344        visibilityFilterWidth   0.01 
    4445        visibilityFile visibility.xml 
     
    279280#       filename ../data/soda/soda5-viewcells.xml 
    280281#       filename ../scripts/viewcells_atlanta.xml 
    281 #       filename ../data/soda/soda5-viewcells2.xml 
     282        filename ../data/soda/soda5-viewcells2.xml 
    282283#       filename ../data/atlanta/viewcells_atlanta3.xml 
    283         filename ../data/vienna/viewcells_vienna.xml 
     284#       filename ../data/vienna/viewcells_vienna.xml 
    284285#       filename ../data/vienna/viewcells_vienna2.xml 
    285286#       filename ../data/vienna/vienna_simple-21-04-avs2-viewCells.xml 
Note: See TracChangeset for help on using the changeset viewer.