Ignore:
Timestamp:
03/09/06 04:27:07 (18 years ago)
Author:
mattausch
Message:

fixed a bsp node geometry problem (debug code)

File:
1 edited

Legend:

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

    r682 r683  
    25112511                        Plane3 halfSpace = dynamic_cast<BspInterior *>(interior)->GetPlane(); 
    25122512 
    2513             if (interior->GetFront() != lastNode) 
     2513            if (interior->GetBack() != lastNode) 
    25142514                                halfSpace.ReverseOrientation(); 
    25152515 
     
    25302530        vector<Plane3> candidatePlanes; 
    25312531 
    2532         // bounded planes are added to the polygons (reverse polygons 
    2533         // as they have to be outfacing) 
     2532        // bounded planes are added to the polygons 
    25342533        for (int i = 0; i < (int)halfSpaces.size(); ++ i) 
    25352534        { 
     
    25382537                if (p->Valid(mEpsilon)) 
    25392538                { 
    2540                         candidatePolys.push_back(p->CreateReversePolygon()); 
    2541                         // Why? 
    2542                         Plane3 candidatePlane = p->GetSupportingPlane(); //halfSpaces[i]; 
    2543                         //candidatePlane.ReverseOrientation(); 
    2544                         candidatePlanes.push_back(candidatePlane); 
    2545  
    2546                         DEL_PTR(p); 
     2539                        candidatePolys.push_back(p); 
     2540                        candidatePlanes.push_back(halfSpaces[i]); 
    25472541                } 
    25482542        } 
     
    25902584                                        DEL_PTR(candidatePolys[i]); 
    25912585 
    2592                                         if (frontPoly->Valid(mEpsilon)) 
    2593                                                 candidatePolys[i] = frontPoly; 
     2586                                        if (backPoly->Valid(mEpsilon)) 
     2587                                                candidatePolys[i] = backPoly; 
    25942588                                        else 
    2595                                                 DEL_PTR(frontPoly); 
    2596  
    2597                                         DEL_PTR(backPoly); 
     2589                                                DEL_PTR(backPoly); 
     2590 
     2591                                        // outside, don't need this 
     2592                                        DEL_PTR(frontPoly); 
    25982593                                        break; 
    2599  
    2600                                 case Polygon3::BACK_SIDE: 
     2594                                // polygon outside of halfspace 
     2595                                case Polygon3::FRONT_SIDE: 
    26012596                                        DEL_PTR(candidatePolys[i]); 
    26022597                                        break; 
    26032598                                // just take polygon as it is 
    2604                                 case Polygon3::FRONT_SIDE: 
     2599                                case Polygon3::BACK_SIDE: 
    26052600                                case Polygon3::COINCIDENT: 
    26062601                                default: 
     
    26852680                                                                                                        mEpsilon); 
    26862681 
    2687                                                 if (cf == Polygon3::BACK_SIDE) 
     2682                                                if (cf == Polygon3::FRONT_SIDE) 
    26882683                                                { 
    26892684                                                        isAdjacent = false; 
     
    27042699                                                                                                        mEpsilon); 
    27052700 
    2706                                                 if (cf == Polygon3::BACK_SIDE) 
     2701                                                if (cf == Polygon3::FRONT_SIDE) 
    27072702                                                { 
    27082703                                                        isAdjacent = false; 
     
    27382733                                                                mEpsilon); 
    27392734                 
    2740                         if (cf == Polygon3::FRONT_SIDE) 
    2741                         { 
    2742                                 nodeStack.push(bspNodePair(interior->GetFront(), fGeom)); 
    2743                                 DEL_PTR(bGeom); 
     2735                        if (cf == Polygon3::BACK_SIDE) 
     2736                        { 
     2737                                nodeStack.push(bspNodePair(interior->GetBack(), bGeom)); 
     2738                                DEL_PTR(fGeom); 
    27442739                        } 
    27452740                        else 
    27462741                        { 
    2747                                 if (cf == Polygon3::BACK_SIDE) 
     2742                                if (cf == Polygon3::FRONT_SIDE) 
    27482743                                { 
    2749                                         nodeStack.push(bspNodePair(interior->GetBack(), bGeom)); 
    2750                                         DEL_PTR(fGeom); 
     2744                                        nodeStack.push(bspNodePair(interior->GetFront(), fGeom)); 
     2745                                        DEL_PTR(bGeom); 
    27512746                                } 
    27522747                                else 
     
    28302825                                                                mEpsilon); 
    28312826                 
    2832                         if (cf == Polygon3::FRONT_SIDE) 
    2833                         { 
    2834                                 nodeStack.push(bspNodePair(interior->GetFront(), fGeom)); 
    2835                                 DEL_PTR(bGeom); 
     2827                        if (cf == Polygon3::BACK_SIDE) 
     2828                        { 
     2829                                nodeStack.push(bspNodePair(interior->GetBack(), bGeom)); 
     2830                                DEL_PTR(fGeom); 
    28362831                        } 
    28372832                        else 
    28382833                        { 
    2839                                 if (cf == Polygon3::BACK_SIDE) 
     2834                                if (cf == Polygon3::FRONT_SIDE) 
    28402835                                { 
    2841                                         nodeStack.push(bspNodePair(interior->GetBack(), bGeom)); 
    2842                                         DEL_PTR(fGeom); 
     2836                                        nodeStack.push(bspNodePair(interior->GetFront(), fGeom)); 
     2837                                        DEL_PTR(bGeom); 
    28432838                                } 
    28442839                                else 
     
    30443039 
    30453040        float t; 
    3046         const float thresh = 1 ? 1e-6f : 0.0f; 
     3041        //const float thresh = 1 ? 1e-6f : 0.0f; 
     3042        const float thresh = 0.01f; 
    30473043 
    30483044        while (1) 
Note: See TracChangeset for help on using the changeset viewer.