From cedf5fb284e194011ac025c7b3ee58e8ad636512 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Tue, 25 Oct 2011 10:03:10 +0000 Subject: [PATCH] bug fixing: - mixup of nomes Edge and Face on the components. - possibly use of empty vector in import_obj.h Thanks to nagaokagetora for showing them --- vcg/complex/allocate.h | 2 +- vcg/container/container_allocation_table.h | 3 ++- vcg/simplex/face/component.h | 16 ++++++++-------- wrap/io_trimesh/import_obj.h | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/vcg/complex/allocate.h b/vcg/complex/allocate.h index 71a95fe9..9a4068db 100644 --- a/vcg/complex/allocate.h +++ b/vcg/complex/allocate.h @@ -1034,7 +1034,7 @@ public: template static - typename MeshType::template PerVertexAttributeHandle + typename MeshType::template PerEdgeAttributeHandle AddPerEdgeAttribute( MeshType & m){ return AddPerEdgeAttribute(m,std::string("")); } diff --git a/vcg/container/container_allocation_table.h b/vcg/container/container_allocation_table.h index 6fd8829c..6009c92e 100644 --- a/vcg/container/container_allocation_table.h +++ b/vcg/container/container_allocation_table.h @@ -333,7 +333,8 @@ struct Env{ TypeNameBounds().insert(std::pair(n,res)); return res; } - else (CAT *) (*ti).second; + else + return (CAT *) (*ti).second; } }; diff --git a/vcg/simplex/face/component.h b/vcg/simplex/face/component.h index 98ef621b..d7a4ac58 100644 --- a/vcg/simplex/face/component.h +++ b/vcg/simplex/face/component.h @@ -601,16 +601,16 @@ public: _fep[1]=0; _fep[2]=0; } - typename T::FacePointer &FEp(const int j) { assert(j>=0 && j<3); return _fep[j]; } - typename T::FacePointer const FEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; } - typename T::FacePointer const cFEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; } + typename T::EdgePointer &FEp(const int j) { assert(j>=0 && j<3); return _fep[j]; } + typename T::EdgePointer const FEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; } + typename T::EdgePointer const cFEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; } char &FEi(const int j) { return _fei[j]; } const char &cFEi(const int j) const { return _fei[j]; } - typename T::FacePointer &FEp1( const int j ) { return FEp((j+1)%3);} - typename T::FacePointer &FEp2( const int j ) { return FEp((j+2)%3);} - typename T::FacePointer const FEp1( const int j ) const { return FEp((j+1)%3);} - typename T::FacePointer const FEp2( const int j ) const { return FEp((j+2)%3);} + typename T::EdgePointer &FEp1( const int j ) { return FEp((j+1)%3);} + typename T::EdgePointer &FEp2( const int j ) { return FEp((j+2)%3);} + typename T::EdgePointer const FEp1( const int j ) const { return FEp((j+1)%3);} + typename T::EdgePointer const FEp2( const int j ) const { return FEp((j+2)%3);} template void ImportData(const RightF & rightF){T::ImportData(rightF);} @@ -620,7 +620,7 @@ public: static void Name(std::vector & name){name.push_back(std::string("FEAdj"));T::Name(name);} private: - typename T::FacePointer _fep[3] ; + typename T::EdgePointer _fep[3] ; char _fei[3] ; }; diff --git a/wrap/io_trimesh/import_obj.h b/wrap/io_trimesh/import_obj.h index 097e6fb4..26cfbbaa 100644 --- a/wrap/io_trimesh/import_obj.h +++ b/wrap/io_trimesh/import_obj.h @@ -643,9 +643,9 @@ public: } } } - while (( line[0] == '#' || line.length()==0) && !stream.eof()); // skip comments and empty lines + while (( line.length()==0 || line[0] == '#') && !stream.eof()); // skip comments and empty lines - if ((line[0] == '#') || (line.length() == 0)) // can be true only on last line of file + if ( (line.length() == 0)||(line[0] == '#') ) // can be true only on last line of file return; size_t from = 0;