Ignore:
Timestamp:
03/06/07 14:26:14 (17 years ago)
Author:
gumbau
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/SimplificationMethod.cpp

    r2089 r2194  
    230230//      Contract a given pair 
    231231//------------------------------------------------------------------------- 
    232 void SimplificationMethod::do_contract( simplif::Model& m, 
    233                                                                                                                                                                 simplif::pair_info *auxpair) 
     232void SimplificationMethod::do_contract( simplif::Model                  &m, 
     233                                                                                                                                                                simplif::pair_info      *auxpair, 
     234                                                                                                                                                                int                                                                     obligatory) 
    234235{ 
    235236        simplif::Vertex                 *v0                     = auxpair->v0; 
     
    243244        vertex_map_str                  lb; 
    244245        vertex_map_str                  ub; 
     246 
     247        //      Stores the simplification step. 
     248        MeshSimplificationSequence::Step simplifstep; 
    245249         
    246250        // V0 must be always the alive vertex 
     
    338342 
    339343        int del_index   =       0; 
     344 
     345        //      Initialize deleted triangles. 
     346        simplifstep.mT0 =       -1; 
     347        simplifstep.mT1 =       -1; 
     348 
     349        //      Sets obligatory flag. 
     350        simplifstep.obligatory  =       obligatory; 
    340351 
    341352        //      Clears faces list. 
     
    519530                                (vertexMultimap.find(f0) != vertexMultimap.end()) 
    520531                                && 
    521                                 (vertexMultimap.find(f1) != vertexMultimap.end())) 
     532                                (vertexMultimap.find(f1) != vertexMultimap.end()) 
     533                                && 
     534                                ((*pair->v0) != (*pair->v1))) 
    522535                { 
    523536                        break; 
     
    551564        candidate       =       pair->candidate; 
    552565 
    553         //      First contract. 
    554         simplifstep.obligatory  =       0; 
    555  
    556566        //      Debug. 
    557567        cout    <<      "Contracting... " 
     
    559569 
    560570        //      Contract main pair. 
    561         do_contract(m, pair); 
    562  
    563         //      Twin contract and lonely vertex contract. 
    564         simplifstep.obligatory  =       1; 
     571        do_contract(m, pair, 0); 
    565572 
    566573        //      Attempt to maintain valid vertex information. 
     
    600607        float                                                           x,y,z; 
    601608 
     609        /* 
    602610        if ((*v0) != (*v1)) 
    603611        { 
     612        */ 
    604613                //      Gets the vertex that is not the candidate. 
    605614                if ((*v1) == candidate) 
     
    621630                        lonely_vert     =       m.vertex((*it).second); 
    622631 
     632                        //      Debug. 
     633                        if ((*it).second == 10988) 
     634                        { 
     635                                cout    <<      "Lonely: " 
     636                                                        <<      lonely_vert->vID 
     637                                                        <<      endl; 
     638                        } 
     639                         
    623640                        for (int        i       =       0;      i < lonely_vert->edgeUses().length();   i++) 
    624641                        { 
     
    671688 
    672689                                //      Contract twin pair. 
    673                                 do_contract(m, pair); 
     690                                do_contract(m, pair, 1); 
    674691                                M0.validVertCount--; 
    675692                        } 
     
    686703                                z       =       (*new_vert)[Z]; 
    687704 
     705                                simplif::Vertex *v; 
     706 
     707                                //      Debug. 
     708                                if (new_vert->vID == 10988) 
     709                                { 
     710                                        cout    <<      "[" 
     711                                                                <<      x 
     712                                                                <<      "," 
     713                                                                <<      y 
     714                                                                <<      "," 
     715                                                                <<      z 
     716                                                                <<      "]" 
     717                                                                <<      endl; 
     718 
     719                                         
     720                                        v       =       m.vertex(10988); 
     721                                } 
     722 
    688723                                //      Adds new vertex to multimap. 
    689724                                vertexMultimap.insert(vertex_pair(_float3_(x,y,z),new_vert->vID)); 
     
    724759                                pair->notInHeap(); 
    725760 
     761                                //      Debug. 
     762                                cout    <<      "new: " 
     763                                                        <<      new_vert->vID 
     764                                                        <<      "(" 
     765                                                        <<      (*new_vert)[X] 
     766                                                        <<      "," 
     767                                                        <<      (*new_vert)[Y] 
     768                                                        <<      "," 
     769                                                        <<      (*new_vert)[Z] 
     770                                                        <<      ") lonely: " 
     771                                                        <<      lonely_vert->vID 
     772                                                        <<      "(" 
     773                                                        <<      (*lonely_vert)[X] 
     774                                                        <<      "," 
     775                                                        <<      (*lonely_vert)[Y] 
     776                                                        <<      "," 
     777                                                        <<      (*lonely_vert)[Z] 
     778                                                        <<      ")" 
     779                                                        <<      endl; 
     780 
    726781                                //      Contract new pair. 
    727                                 do_contract(m, pair); 
     782                                do_contract(m, pair, 1); 
    728783                                M0.validVertCount--; 
    729784                        } 
    730785                } 
    731         } 
     786        /* 
     787        } 
     788        */ 
    732789} 
    733790 
Note: See TracChangeset for help on using the changeset viewer.