Changeset 1419


Ignore:
Timestamp:
09/20/06 10:43:22 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/Preprocessing/src
Files:
9 edited

Legend:

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

    r1418 r1419  
    293293        } 
    294294         
     295        //cout << "describe:\n" << dummyMesh << endl; 
     296        //dummyMesh.CheckMesh(); 
     297 
    295298        ExportMesh(&dummyMesh); 
    296299        CLEAR_CONTAINER(polys); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h

    r1418 r1419  
    214214                const bool isTermination) const; 
    215215 
     216        friend ostream &operator<<(ostream &s, const HierarchyManager &hm)  
     217        { 
     218                hm.mHierarchyStats.Print(s); 
     219                return s; 
     220        }  
     221 
    216222protected: 
    217223 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.cpp

    r1418 r1419  
    499499} 
    500500 
     501 
     502bool Mesh::CheckMesh() const 
     503{ 
     504        VertexContainer::const_iterator vit, vit_end = mVertices.end(); 
     505 
     506        for (vit = mVertices.begin(); vit != vit_end; ++ vit) 
     507        { 
     508                for (int i = 0; i < 3; ++ i) 
     509                { 
     510                        const float x = (*vit)[i]; 
     511                        if (x != x) // nan 
     512                        //if (isnan((*vit)[i])) 
     513                        { 
     514                                cout << "warning: vertex is ill defined" << endl; 
     515                                return false; 
     516                        } 
     517                } 
     518        } 
     519        return true; 
     520} 
     521 
     522 
     523void Mesh::Print(ostream &app) const 
     524{ 
     525        VertexContainer::const_iterator vit, vit_end = mVertices.end(); 
     526 
     527        for (vit = mVertices.begin(); vit != vit_end; ++ vit) 
     528        { 
     529                app << (*vit) << " "; 
     530        } 
     531        app << endl; 
     532 
     533        /*FaceContainer::const_iterator fit, fit_end = mVertices.end(); 
     534 
     535        for (vit = mVertices.begin(); vit != vit_end; ++ vit) 
     536        { 
     537                app << (*vit); 
     538        } 
     539        app << endl;*/ 
     540} 
     541 
     542 
    501543void 
    502544Mesh::Cleanup() 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h

    r1418 r1419  
    210210  Vector3 GetNormal(const int idx) const; 
    211211 
    212   virtual ostream &Describe(ostream &s) { 
     212  // $$ matt temp 
     213  bool CheckMesh() const; 
     214 
     215  void Print(ostream &app) const; 
     216 
     217  virtual ostream &Describe(ostream &s) const { 
    213218        return s<<"Mesh #vertices="<<(int)mVertices.size()<<" #faces="<<(int)mFaces.size(); 
    214219  } 
     
    219224  friend Mesh *CreateMeshFromBox(const AxisAlignedBox3 &box); 
    220225 
    221   
     226  friend ostream& operator<< (ostream &s, const Vector3 &A); 
     227 
    222228protected: 
    223229 
     
    225231  int mId; 
    226232}; 
     233 
     234 
     235// Overload << operator for C++-style output 
     236inline ostream& 
     237operator<< (ostream &s, const Mesh &A) 
     238{ 
     239        A.Print(s); 
     240        return s; 
     241} 
    227242 
    228243 
  • GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.cpp

    r1379 r1419  
    182182                 meshProxy.IndexVertices(); 
    183183            
    184            Mesh *mesh = new Mesh(meshProxy.mVertices.size(), 
    185                                                          meshProxy.mFaces.size()); 
     184           Mesh *mesh = new Mesh((int)meshProxy.mVertices.size(), 
     185                                                         (int)meshProxy.mFaces.size()); 
    186186            
    187187            
     
    210210   for (int k  = 0; k < flist[i]->nverts; k++) { 
    211211         Vertex *v = vlist[flist[i]->verts[k]]; 
    212          vc.push_back(meshProxy.mVertices.size()); 
     212         vc.push_back((int)meshProxy.mVertices.size()); 
    213213         meshProxy.mVertices.push_back(Vector3(v->x, v->y, v->z)); 
    214214   } 
     
    222222         meshProxy.IndexVertices(); 
    223223 
    224    Mesh *mesh = new Mesh(meshProxy.mVertices.size(), 
    225                                                  meshProxy.mFaces.size()); 
     224   Mesh *mesh = new Mesh((int)meshProxy.mVertices.size(), 
     225                                                 (int)meshProxy.mFaces.size()); 
    226226 
    227227   mesh->mVertices = meshProxy.mVertices; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp

    r1418 r1419  
    6767        mVertices.push_back(tri.mVertices[2]); 
    6868 
     69        VertexContainer::iterator it, it_end = mVertices.end(); 
     70 
     71        for (it = mVertices.begin(); it != it_end;  ++ it) 
     72        { 
     73                cout << (*it) << " "; 
     74        }cout<<endl<<endl; 
    6975        //cout << "poly n: " << GetNormal() << " t normal: " << tri.GetNormal() << endl; 
    7076} 
     
    584590        const int n = (int)mesh.mVertices.size(); 
    585591 
    586     //-- add the vertices 
     592        ///////////// 
     593    //-- add the vertices to the mesh 
     594 
    587595    VertexContainer::const_iterator vit, vit_end = poly.mVertices.end(); 
    588596        for (vit = poly.mVertices.begin(); vit != vit_end; ++ vit) 
     
    602610 
    603611        // add indices of triangle strip 
    604         for (int i = 0; i < (int)indices.size(); i += 3) 
    605         { 
    606                 Face *face = new Face(n + indices[i],  
    607                                                           n + indices[i + 1],  
    608                                                           n + indices[i + 2]); 
     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]); 
    609617                mesh.AddFace(face); 
    610618        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1418 r1419  
    380380 
    381381 
    382         //////////////////////////////////////////////// 
    383         // 
     382        ////////////////////// 
    384383        //-- Cast some more sampling after initial construction. 
    385384        //-- The additional rays can be used to gain 
     
    444443 
    445444        //////////////////// 
    446         // 
    447445        //-- post processing of the initial construction 
    448446        //-- We can bottom-up merge the view cells in this step 
     
    47964794 
    47974795        // print subdivision statistics 
    4798         Debug << endl << endl; 
    4799         mHierarchyManager->PrintHierarchyStatistics(Debug); 
     4796        Debug << endl << endl << mHierarchyManager << endl; 
     4797        //mHierarchyManager->PrintHierarchyStatistics(Debug); 
    48004798 
    48014799        if (0) 
     
    51575155        cout << "visualization using " << (int)rays.size() << " samples" << endl; 
    51585156        Debug << "visualization using " << (int)rays.size() << " samples" << endl; 
    5159         Debug << "\nOutput view cells: " << endl; 
    5160  
     5157         
    51615158        const bool sortedViewCells = false; 
    51625159 
     
    51695166        int limit = min(leafOut, (int)mViewCells.size()); 
    51705167        int raysOut = 0; 
     5168 
     5169        cout << "\nOutput of " << limit << " view cells: " << endl; 
    51715170 
    51725171        /////////////// 
     
    52345233                                //-- export objects seen from the rays 
    52355234                                Intersectable::NewMail(); 
    5236                 VssRayContainer::const_iterator vcit, vcit_end = vcRays.end(); 
     5235                                 
     5236                                VssRayContainer::const_iterator vcit, vcit_end = vcRays.end(); 
    52375237                                for (vcit = vcRays.begin(); vcit != vcit_end; ++ vcit) 
    52385238                                { 
     
    52445244                                        { 
    52455245                                                obj->Mail(); 
    5246                                         //      exporter->ExportIntersectable(obj); 
     5246                                                exporter->ExportIntersectable(obj); 
    52475247                                        } 
    52485248                                } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp

    r1404 r1419  
    125125          const Vector3 a = (*ri)->GetOrigin(); 
    126126          const Vector3 b = (*ri)->mTerminationObject ? (*ri)->GetTermination() : a + 1000 * Normalize((*ri)->GetDir()); 
    127           //const Vector3 b = (*ri)->GetTermination(); // matt: change back!! 
    128  
    129           stream << a.x << " " << a.y << " " << a.z << " ,"; 
    130           stream << b.x << " " << b.y << " " << b.z << " ,\n"; 
     127           
     128          bool isnan = false; 
     129 
     130          if ((a[0] != a[0]) || (a[1] != a[1]) || (a[2] != a[2])) 
     131          { 
     132                  cout << "error a"<<endl; 
     133                  isnan = true; 
     134          } 
     135 
     136          if ((b[0] != b[0]) || (b[1] != b[1]) || (b[2] != b[2])) 
     137          { 
     138                  cout << "error b"<<endl; 
     139                  isnan = true; 
     140          } 
     141 
     142          if (!isnan) 
     143          { 
     144                stream << a.x << " " << a.y << " " << a.z << " ,"; 
     145                stream << b.x << " " << b.y << " " << b.z << " ,\n"; 
     146          } 
    131147  } 
    132148 
  • GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp

    r1418 r1419  
    255255                        { 
    256256                                TriangleIntersectable *ti = new TriangleIntersectable(*tit); 
     257                                cout << "t: " << (*tit) << endl; 
    257258                                mCurrentNode->mGeometry.push_back(ti); 
    258259                        } 
Note: See TracChangeset for help on using the changeset viewer.