Ignore:
Timestamp:
09/20/06 13:37:29 (18 years ago)
Author:
mattausch
Message:

corrected raycasting bug for triangles because of ill defined triangles

File:
1 edited

Legend:

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

    r1419 r1420  
    4343{        
    4444        mVertices.reserve(face->mVertexIndices.size()); 
    45          
    4645        VertexIndexContainer::iterator it, it_end = face->mVertexIndices.end(); 
    4746 
    48         for (it = face->mVertexIndices.begin(); it != it_end;  ++ it) 
     47        for (it = face->mVertexIndices.begin(); it != it_end; ++ it) 
    4948        { 
    5049                mVertices.push_back(parentMesh->mVertices[*it]); 
     
    6968        VertexContainer::iterator it, it_end = mVertices.end(); 
    7069 
    71         for (it = mVertices.begin(); it != it_end;  ++ it) 
    72         { 
    73                 cout << (*it) << " "; 
    74         }cout<<endl<<endl; 
     70        //for (it = mVertices.begin(); it != it_end;  ++ it){cout << (*it) << " ";}cout<<endl<<endl; 
    7571        //cout << "poly n: " << GetNormal() << " t normal: " << tri.GetNormal() << endl; 
    7672} 
     
    267263} 
    268264 
     265 
    269266bool Polygon3::Valid(const float epsilon) const 
    270267{ 
     
    272269                return false; 
    273270 
    274         //TODO: remove for performance 
    275 #if 0 
    276         if (1) 
     271        // matt: removed for performance issues 
     272#if _DEBUG 
     273        if (0) 
    277274        { 
    278275                // check if area exceeds certain size 
     
    291288                for (it = mVertices.begin(); it != it_end; ++it) 
    292289                { 
    293                         if (EpsilonEqualV3(vtx, *it, 0.0001)) 
     290                        if (EpsilonEqualV3(vtx, *it, epsilon)) 
    294291                        { 
    295                                 //Debug << "Malformed vertices:\n" << *this << endl; 
     292                                //cout << "Malformed vertices:\n" << *this << endl; 
    296293                                return false; 
    297294                        } 
     
    590587        const int n = (int)mesh.mVertices.size(); 
    591588 
     589 
    592590        ///////////// 
    593591    //-- add the vertices to the mesh 
     
    609607        poly.Triangulate(indices); 
    610608 
     609        //if (indices.size() < 3) return; // something is wrong 
     610         
    611611        // add indices of triangle strip 
    612         for (int i = n; i < (int)indices.size() + n; i += 3) 
    613         { 
    614                 Face *face = new Face(indices[i],  
    615                                                           indices[i + 1],  
    616                                                           indices[i + 2]); 
     612        for (int i = 0; i < (int)indices.size(); i += 3) 
     613        { 
     614                Face *face = new Face(indices[i] + n,  
     615                                                          indices[i + 1] + n,  
     616                                                          indices[i + 2] + n); 
    617617                mesh.AddFace(face); 
    618618        } 
Note: See TracChangeset for help on using the changeset viewer.