Ignore:
Timestamp:
04/27/06 11:57:28 (18 years ago)
Author:
mattausch
Message:

implementing bounding box hack

File:
1 edited

Legend:

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

    r683 r840  
    498498 
    499499 
    500 void Polygon3::Triangulate(vector<Triangle3> &triangles) 
     500void Polygon3::Triangulate(vector<Triangle3> &triangles) const 
    501501{ 
    502502        int i = 1; 
     
    517517 
    518518 
    519 void Polygon3::Triangulate(VertexIndexContainer &indices) 
     519void Polygon3::Triangulate(VertexIndexContainer &indices) const 
    520520{ 
    521521        int i = 1; 
     
    539539 
    540540 
    541 void Polygon3::AddToMesh(Mesh &mesh) 
     541void IncludePolyInMesh(const Polygon3 &poly, Mesh &mesh) 
    542542{ 
    543543        const int n = (int)mesh.mVertices.size(); 
    544544 
    545545    //-- add the vertices 
    546     VertexContainer::const_iterator vit, vit_end = mVertices.end(); 
    547         for (vit = mVertices.begin(); vit != vit_end; ++ vit) 
     546    VertexContainer::const_iterator vit, vit_end = poly.mVertices.end(); 
     547        for (vit = poly.mVertices.begin(); vit != vit_end; ++ vit) 
    548548        { 
    549549                mesh.mVertices.push_back(*vit); 
     
    551551 
    552552        // one quad => no triangulation necessary 
    553         if ((int)mVertices.size() == 4) 
     553        if (poly.mVertices.size() == 4) 
    554554        { 
    555555                mesh.AddFace(new Face(n, n + 1, n + 2, n + 3)); 
    556         } 
    557         else 
    558         { 
    559                 VertexIndexContainer indices; 
    560                 Triangulate(indices); 
    561  
    562                 // add indices of triangle strip 
    563                 for (int i = 0; i < (int)indices.size(); i += 3) 
    564                 { 
    565                         Face *face = new Face(n + indices[i],  
    566                                                                   n + indices[i + 1],  
    567                                                                   n + indices[i + 2]); 
    568                         mesh.AddFace(face); 
    569                 } 
    570         } 
    571 } 
     556                return; 
     557        } 
     558         
     559        VertexIndexContainer indices; 
     560        poly.Triangulate(indices); 
     561 
     562        // add indices of triangle strip 
     563        for (int i = 0; i < (int)indices.size(); i += 3) 
     564        { 
     565                Face *face = new Face(n + indices[i],  
     566                                                          n + indices[i + 1],  
     567                                                          n + indices[i + 2]); 
     568                mesh.AddFace(face); 
     569        } 
     570} 
Note: See TracChangeset for help on using the changeset viewer.