Ignore:
Timestamp:
01/22/07 23:35:03 (17 years ago)
Author:
mattausch
Message:

changed to static cast

File:
1 edited

Legend:

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

    r2015 r2017  
    268268 
    269269 
    270  
    271  
     270bool VspInterior::IsLeaf() const 
     271{  
     272        return false;  
     273} 
     274 
     275 
     276VspNode *VspInterior::GetBack()  
     277{ 
     278        return mBack; 
     279} 
     280 
     281 
     282VspNode *VspInterior::GetFront()  
     283{ 
     284        return mFront; 
     285} 
     286 
     287 
     288AxisAlignedPlane VspInterior::GetPlane() const 
     289{ 
     290        return mPlane; 
     291} 
     292 
     293 
     294float VspInterior::GetPosition() const 
     295{ 
     296        return mPlane.mPosition; 
     297} 
     298 
     299 
     300int VspInterior::GetAxis() const 
     301{ 
     302        return mPlane.mAxis; 
     303} 
    272304 
    273305 
     
    356388 
    357389 
     390ViewCellLeaf *VspLeaf::GetViewCell() const 
     391{ 
     392        return mViewCell; 
     393} 
    358394 
    359395 
     
    364400 
    365401 
     402bool VspLeaf::IsLeaf() const  
     403{  
     404        return true;  
     405} 
    366406 
    367407 
     
    665705        // todo remove dynamic cast 
    666706        VspSubdivisionCandidate *sc =  
    667                 dynamic_cast<VspSubdivisionCandidate *>(splitCandidate); 
     707                static_cast<VspSubdivisionCandidate *>(splitCandidate); 
    668708 
    669709        VspTraversalData &tData = sc->mParentData; 
     
    718758        if (newNode->IsLeaf()) // subdivision terminated 
    719759        { 
    720                 VspLeaf *leaf = dynamic_cast<VspLeaf *>(newNode); 
     760                VspLeaf *leaf = static_cast<VspLeaf *>(newNode); 
    721761                 
    722762#if 0 
     
    787827        } 
    788828         
    789         VspLeaf *leaf = dynamic_cast<VspLeaf *>(splitCandidate.mParentData.mNode); 
     829        VspLeaf *leaf = static_cast<VspLeaf *>(splitCandidate.mParentData.mNode); 
    790830 
    791831        ///////////// 
     
    882922                                                                        VspTraversalData &backData) 
    883923{ 
    884         VspLeaf *leaf = dynamic_cast<VspLeaf *>(sc.mParentData.mNode); 
     924        VspLeaf *leaf = static_cast<VspLeaf *>(sc.mParentData.mNode); 
    885925 
    886926        const VspTraversalData &tData = sc.mParentData; 
     
    14411481                if (parent) 
    14421482                { 
    1443                         parentAxis = dynamic_cast<VspInterior *>(parent)->GetAxis(); 
     1483                        parentAxis = static_cast<VspInterior *>(parent)->GetAxis(); 
    14441484                } 
    14451485 
     
    18161856                { 
    18171857                        // test if this leaf is in valid view space 
    1818                         VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     1858                        VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    18191859 
    18201860                        if (leaf->TreeValid() &&  
     
    18271867                else 
    18281868                { 
    1829                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     1869                        VspInterior *interior = static_cast<VspInterior *>(node); 
    18301870 
    18311871                        nodeStack.push(interior->GetBack()); 
     
    18511891{ 
    18521892        // the node became a leaf -> evaluate stats for leafs 
    1853         VspLeaf *leaf = dynamic_cast<VspLeaf *>(data.mNode); 
     1893        VspLeaf *leaf = static_cast<VspLeaf *>(data.mNode); 
    18541894 
    18551895        if (data.mPvs > mVspStats.maxPvs) 
     
    19261966                if (node->IsLeaf()) 
    19271967        { 
    1928                         BspViewCell *viewCell = dynamic_cast<VspLeaf *>(node)->GetViewCell(); 
     1968                        BspViewCell *viewCell = static_cast<VspLeaf *>(node)->GetViewCell(); 
    19291969 
    19301970                        if (!viewCell->GetValid()) 
    19311971                        { 
    1932                                 BspViewCell *viewCell = dynamic_cast<VspLeaf *>(node)->GetViewCell(); 
     1972                                BspViewCell *viewCell = static_cast<VspLeaf *>(node)->GetViewCell(); 
    19331973         
    19341974                                ViewCellContainer leaves; 
     
    19391979                                for (it = leaves.begin(); it != it_end; ++ it) 
    19401980                                { 
    1941                                         VspLeaf *l = dynamic_cast<BspViewCell *>(*it)->mLeaf; 
     1981                                        VspLeaf *l = static_cast<BspViewCell *>(*it)->mLeaf; 
    19421982                                        l->SetViewCell(GetOrCreateOutOfBoundsCell()); 
    19431983                                        ++ mVspStats.invalidLeaves; 
     
    19521992                else 
    19531993                { 
    1954                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     1994                        VspInterior *interior = static_cast<VspInterior *>(node); 
    19551995                 
    19561996                        nodeStack.push(interior->GetFront()); 
     
    20052045                if (node->IsLeaf()) 
    20062046                { 
    2007                         VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     2047                        VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    20082048 
    20092049                        if (!leaf->GetViewCell()->GetValid()) 
     
    20192059                else 
    20202060                { 
    2021                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2061                        VspInterior *interior = static_cast<VspInterior *>(node); 
    20222062                 
    20232063                        nodeStack.push(interior->GetFront()); 
     
    20512091                        if (!onlyValid || node->TreeValid()) 
    20522092                        { 
    2053                                 ViewCellLeaf *leafVc = dynamic_cast<VspLeaf *>(node)->GetViewCell(); 
     2093                                ViewCellLeaf *leafVc = static_cast<VspLeaf *>(node)->GetViewCell(); 
    20542094 
    20552095                                ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leafVc); 
     
    20642104                else 
    20652105                { 
    2066                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2106                        VspInterior *interior = static_cast<VspInterior *>(node); 
    20672107                 
    20682108                        nodeStack.push(interior->GetFront()); 
     
    20892129                if (node->IsLeaf()) 
    20902130                { 
    2091                         VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     2131                        VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    20922132 
    20932133                        if (leaf != n && (!onlyUnmailed || !leaf->Mailed())) 
     
    20962136                else 
    20972137                { 
    2098                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2138                        VspInterior *interior = static_cast<VspInterior *>(node); 
    20992139                         
    21002140                        if (interior->GetPosition() > box.Max(interior->GetAxis())) 
     
    21342174                if (node->IsLeaf())  
    21352175                { 
    2136                         return dynamic_cast<VspLeaf *>(node); 
     2176                        return static_cast<VspLeaf *>(node); 
    21372177                }  
    21382178                else  
    21392179                { 
    2140                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2180                        VspInterior *interior = static_cast<VspInterior *>(node); 
    21412181                        VspNode *next; 
    21422182                         
     
    21862226                { 
    21872227                        if ( (!onlyUnmailed || !node->Mailed()) ) 
    2188                                 return dynamic_cast<VspLeaf *>(node); 
     2228                                return static_cast<VspLeaf *>(node); 
    21892229                } 
    21902230                else 
    21912231                { 
    2192                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2232                        VspInterior *interior = static_cast<VspInterior *>(node); 
    21932233 
    21942234                        // random decision 
     
    23362376        int axis; 
    23372377 
    2338         ViewCell::NewMail(); 
    2339          
    23402378        while (1) 
    23412379        { 
    23422380                if (!node->IsLeaf()) 
    23432381                { 
    2344                         VspInterior *in = (VspInterior *)node; 
     2382                        VspInterior *in = static_cast<VspInterior *>(node); 
    23452383                        position = in->GetPosition(); 
    23462384                        axis = in->GetAxis(); 
     
    23872425                { 
    23882426                        // compute intersection with all objects in this leaf 
    2389                         VspLeaf *leaf = (VspLeaf *)node; 
     2427                        VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    23902428                        ViewCell *viewCell; 
    2391                         //                      if (0) 
    2392                         //                              viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 
    2393                         //                      else 
    2394  
    2395                         viewCell = leaf->GetViewCell(); 
    2396                          
     2429                        if (0) 
     2430                                viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 
     2431                        else 
     2432                                viewCell = leaf->GetViewCell(); 
     2433 
    23972434                        // don't have to mail if each view cell belongs to exactly one leaf 
    2398                         // $$ JB -> always mailbox so that we have less conditions 
    2399                         if (!viewCell->Mailed()) { 
    2400                           viewCell->Mail(); 
    2401                            
    2402                           viewcells.push_back(viewCell); 
    2403                           ++ hits; 
    2404                         } 
    2405                          
     2435                        if (!useMailboxing || !viewCell->Mailed()) 
     2436                        { 
     2437                                if (useMailboxing) 
     2438                                        viewCell->Mail(); 
     2439 
     2440                                viewcells.push_back(viewCell); 
     2441                                ++ hits; 
     2442                        } 
     2443 
    24062444                        // get the next node from the stack 
    24072445                        if (tStack.empty()) 
    2408                           break; 
    2409                          
     2446                                break; 
     2447 
    24102448                        entp = extp; 
    24112449                        mint = maxt; 
     
    24542492                if (!node->IsLeaf()) 
    24552493                { 
    2456                         VspInterior *in = dynamic_cast<VspInterior *>(node); 
     2494                        VspInterior *in = static_cast<VspInterior *>(node); 
    24572495                        position = in->GetPosition(); 
    24582496                        axis = in->GetAxis(); 
     
    24992537                { 
    25002538                        // compute intersection with all objects in this leaf 
    2501                         VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     2539                        VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    25022540                        ViewCell *vc = leaf->GetViewCell(); 
    25032541 
     
    25452583                if (node->IsLeaf())  
    25462584                { 
    2547                         /*const AxisAlignedBox3 box = GetBoundingBox(dynamic_cast<VspLeaf *>(node)); 
     2585                        /*const AxisAlignedBox3 box = GetBoundingBox(static_cast<VspLeaf *>(node)); 
    25482586                        if (!box.IsInside(point)) 
    25492587                                cerr << "error, point " << point << " should be in view cell " << box << endl; 
    25502588                        */       
    2551                         viewcell = dynamic_cast<VspLeaf *>(node)->GetViewCell(); 
     2589                        viewcell = static_cast<VspLeaf *>(node)->GetViewCell(); 
    25522590                        break; 
    25532591                }  
    25542592                else     
    25552593                {        
    2556                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2594                        VspInterior *interior = static_cast<VspInterior *>(node); 
    25572595      
    25582596                        // random decision 
     
    25922630                        return false; 
    25932631                         
    2594                 VspInterior *in = dynamic_cast<VspInterior *>(node); 
     2632                VspInterior *in = static_cast<VspInterior *>(node); 
    25952633                                         
    25962634                if (in->GetPosition() - viewPoint[in->GetAxis()] <= 0)  
     
    26282666                { 
    26292667            node = node->GetParent(); 
    2630                         VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2668                        VspInterior *interior = static_cast<VspInterior *>(node); 
    26312669                         
    26322670                        // the parent is valid iff both leaves are valid 
     
    26502688        if (node->IsLeaf()) 
    26512689        { 
    2652                 VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     2690                VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    26532691                ViewCell *viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 
    26542692 
     
    26612699        else 
    26622700        {        
    2663                 VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2701                VspInterior *interior = static_cast<VspInterior *>(node); 
    26642702         
    26652703                AxisAlignedPlane plane = interior->GetPlane(); 
     
    27312769        if (!node->IsLeaf()) 
    27322770        { 
    2733                 return (dynamic_cast<VspInterior *>(node))->GetBoundingBox();            
    2734         } 
    2735  
    2736         VspInterior *parent = dynamic_cast<VspInterior *>(node->GetParent()); 
     2771                return (static_cast<VspInterior *>(node))->GetBoundingBox();             
     2772        } 
     2773 
     2774        VspInterior *parent = static_cast<VspInterior *>(node->GetParent()); 
    27372775 
    27382776        AxisAlignedBox3 box(parent->GetBoundingBox()); 
     
    27662804                  if (node->IsLeaf()) 
    27672805                        { 
    2768                           VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     2806                          VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    27692807                           
    27702808                          if (!leaf->GetViewCell()->Mailed() && leaf->TreeValid()) 
     
    27762814                  else  
    27772815                        { 
    2778                           VspInterior *interior = dynamic_cast<VspInterior *>(node); 
     2816                          VspInterior *interior = static_cast<VspInterior *>(node); 
    27792817                           
    27802818                          VspNode *first = interior->GetFront(); 
     
    28872925         
    28882926        // root and bounding box were already constructed 
    2889         VspLeaf *leaf = dynamic_cast<VspLeaf *>(mRoot); 
     2927        VspLeaf *leaf = static_cast<VspLeaf *>(mRoot); 
    28902928 
    28912929        ////////// 
     
    33043342{ 
    33053343        // todo remove dynamic cast 
    3306         VspSubdivisionCandidate *sc = dynamic_cast<VspSubdivisionCandidate *>(splitCandidate); 
     3344        VspSubdivisionCandidate *sc = static_cast<VspSubdivisionCandidate *>(splitCandidate); 
    33073345 
    33083346        VspTraversalData &tData = sc->mParentData; 
     
    33183356                VspTraversalData tBackData; 
    33193357                 
    3320                 VspInterior *oldInterior = dynamic_cast<VspInterior *>(oldNode); 
     3358                VspInterior *oldInterior = static_cast<VspInterior *>(oldNode); 
    33213359 
    33223360                // create new interior node and two leaf node 
     
    33873425                { 
    33883426                        const ObjectPvsEntry &entry = oit.Next(); 
    3389                         BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject); 
     3427                        BvhNode *obj = static_cast<BvhNode *>(entry.mObject); 
    33903428 
    33913429                        if (!obj->IsRoot()) 
     
    34163454                { 
    34173455                        const ObjectPvsEntry &entry = oit.Next(); 
    3418                         BvhNode *obj = dynamic_cast<BvhNode *>(entry.mObject); 
     3456                        BvhNode *obj = static_cast<BvhNode *>(entry.mObject); 
    34193457 
    34203458                        if (!obj->IsRoot()) 
     
    34863524                if (!node->IsLeaf()) 
    34873525                { 
    3488                         VspInterior *in = dynamic_cast<VspInterior *>(node); 
     3526                        VspInterior *in = static_cast<VspInterior *>(node); 
    34893527                        position = in->GetPosition(); 
    34903528                        axis = in->GetAxis(); 
     
    35313569                { 
    35323570                        // compute intersection with all objects in this leaf 
    3533                         VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     3571                        VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    35343572                        ViewCell *viewCell; 
    35353573                        if (0) 
Note: See TracChangeset for help on using the changeset viewer.