Ignore:
Timestamp:
02/01/07 18:30:35 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2072 r2073  
    34633463 
    34643464 
    3465 bool VspTree::LineSegmentIntersects(const Vector3 &origin,  
    3466                                                                         const Vector3 &termination,  
    3467                                                                         ViewCell *viewCell) 
    3468 { 
    3469         /*float mint = 0.0f, maxt = 1.0f; 
    3470         const Vector3 dir = termination - origin; 
    3471  
    3472         stack<LineTraversalData> tStack; 
    3473  
    3474         Vector3 entp = origin; 
    3475         Vector3 extp = termination; 
    3476  
    3477         VspNode *node = mRoot; 
    3478         VspNode *farChild; 
    3479  
    3480         float position; 
    3481         int axis; 
    3482  
    3483         while (1) 
    3484         { 
    3485                 if (!node->IsLeaf()) 
    3486                 { 
    3487                         VspInterior *in = static_cast<VspInterior *>(node); 
    3488                         position = in->GetPosition(); 
    3489                         axis = in->GetAxis(); 
    3490  
    3491                         if (entp[axis] <= position) 
    3492                         { 
    3493                                 if (extp[axis] <= position) 
    3494                                 { 
    3495                                         node = in->GetBack(); 
    3496                                         // cases N1,N2,N3,P5,Z2,Z3 
    3497                                         continue; 
    3498                                 } else 
    3499                                 { 
    3500                                         // case N4 
    3501                                         node = in->GetBack(); 
    3502                                         farChild = in->GetFront(); 
    3503                                 } 
    3504                         } 
    3505                         else 
    3506                         { 
    3507                                 if (position <= extp[axis]) 
    3508                                 { 
    3509                                         node = in->GetFront(); 
    3510                                         // cases P1,P2,P3,N5,Z1 
    3511                                         continue; 
    3512                                 } 
    3513                                 else 
    3514                                 { 
    3515                                         node = in->GetFront(); 
    3516                                         farChild = in->GetBack(); 
    3517                                         // case P4 
    3518                                 } 
    3519                         } 
    3520  
    3521                         // $$ modification 3.5.2004 - hints from Kamil Ghais 
    3522                         // case N4 or P4 
    3523                         const float tdist = (position - origin[axis]) / dir[axis]; 
    3524                         tStack.push(LineTraversalData(farChild, extp, maxt)); //TODO 
    3525  
    3526                         extp = origin + dir * tdist; 
    3527                         maxt = tdist; 
    3528                 } 
    3529                 else 
    3530                 { 
    3531                         // compute intersection with all objects in this leaf 
    3532                         VspLeaf *leaf = static_cast<VspLeaf *>(node); 
    3533                         ViewCell *viewCell; 
    3534                         if (0) 
    3535                                 viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 
    3536                         else 
    3537                                 viewCell = leaf->GetViewCell(); 
    3538  
    3539                         if (viewCell == currentViewCell) 
    3540                                 return true; 
    3541                  
    3542                         // get the next node from the stack 
    3543                         if (tStack.empty()) 
    3544                                 break; 
    3545  
    3546                         entp = extp; 
    3547                         mint = maxt; 
    3548                          
    3549                         LineTraversalData &s  = tStack.top(); 
    3550                         node = s.mNode; 
    3551                         extp = s.mExitPoint; 
    3552                         maxt = s.mMaxT; 
    3553  
    3554                         tStack.pop(); 
    3555                 } 
    3556         } 
    3557 */ 
    3558         return false; 
    3559 } 
    3560  
    3561  
    3562 } 
     3465} 
Note: See TracChangeset for help on using the changeset viewer.