Ignore:
Timestamp:
01/15/07 08:37:28 (17 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r1919 r1977  
    35023502} 
    35033503 
    3504 } 
     3504 
     3505bool VspTree::LineSegmentIntersects(const Vector3 &origin,  
     3506                                                                        const Vector3 &termination,  
     3507                                                                        ViewCell *viewCell) 
     3508{ 
     3509        /*float mint = 0.0f, maxt = 1.0f; 
     3510        const Vector3 dir = termination - origin; 
     3511 
     3512        stack<LineTraversalData> tStack; 
     3513 
     3514        Vector3 entp = origin; 
     3515        Vector3 extp = termination; 
     3516 
     3517        VspNode *node = mRoot; 
     3518        VspNode *farChild; 
     3519 
     3520        float position; 
     3521        int axis; 
     3522 
     3523        while (1) 
     3524        { 
     3525                if (!node->IsLeaf()) 
     3526                { 
     3527                        VspInterior *in = dynamic_cast<VspInterior *>(node); 
     3528                        position = in->GetPosition(); 
     3529                        axis = in->GetAxis(); 
     3530 
     3531                        if (entp[axis] <= position) 
     3532                        { 
     3533                                if (extp[axis] <= position) 
     3534                                { 
     3535                                        node = in->GetBack(); 
     3536                                        // cases N1,N2,N3,P5,Z2,Z3 
     3537                                        continue; 
     3538                                } else 
     3539                                { 
     3540                                        // case N4 
     3541                                        node = in->GetBack(); 
     3542                                        farChild = in->GetFront(); 
     3543                                } 
     3544                        } 
     3545                        else 
     3546                        { 
     3547                                if (position <= extp[axis]) 
     3548                                { 
     3549                                        node = in->GetFront(); 
     3550                                        // cases P1,P2,P3,N5,Z1 
     3551                                        continue; 
     3552                                } 
     3553                                else 
     3554                                { 
     3555                                        node = in->GetFront(); 
     3556                                        farChild = in->GetBack(); 
     3557                                        // case P4 
     3558                                } 
     3559                        } 
     3560 
     3561                        // $$ modification 3.5.2004 - hints from Kamil Ghais 
     3562                        // case N4 or P4 
     3563                        const float tdist = (position - origin[axis]) / dir[axis]; 
     3564                        tStack.push(LineTraversalData(farChild, extp, maxt)); //TODO 
     3565 
     3566                        extp = origin + dir * tdist; 
     3567                        maxt = tdist; 
     3568                } 
     3569                else 
     3570                { 
     3571                        // compute intersection with all objects in this leaf 
     3572                        VspLeaf *leaf = dynamic_cast<VspLeaf *>(node); 
     3573                        ViewCell *viewCell; 
     3574                        if (0) 
     3575                                viewCell = mViewCellsTree->GetActiveViewCell(leaf->GetViewCell()); 
     3576                        else 
     3577                                viewCell = leaf->GetViewCell(); 
     3578 
     3579                        if (viewCell == currentViewCell) 
     3580                                return true; 
     3581                 
     3582                        // get the next node from the stack 
     3583                        if (tStack.empty()) 
     3584                                break; 
     3585 
     3586                        entp = extp; 
     3587                        mint = maxt; 
     3588                         
     3589                        LineTraversalData &s  = tStack.top(); 
     3590                        node = s.mNode; 
     3591                        extp = s.mExitPoint; 
     3592                        maxt = s.mMaxT; 
     3593 
     3594                        tStack.pop(); 
     3595                } 
     3596        } 
     3597*/ 
     3598        return false; 
     3599} 
     3600 
     3601 
     3602} 
Note: See TracChangeset for help on using the changeset viewer.