diff --git a/vcg/complex/algorithms/harmonic.h b/vcg/complex/algorithms/harmonic.h index f2e6dd99..ec9a67cd 100644 --- a/vcg/complex/algorithms/harmonic.h +++ b/vcg/complex/algorithms/harmonic.h @@ -218,16 +218,18 @@ public: // get the adjacent face const FaceType * fp = f.cFFp(edge); - // v0 - // /|\ - // / | \ - // / | \ - // / | \ - // va\ | /vb - // \ | / - // \ | / - // \|/ - // v1 + /* + * v0 + * /|\ + * / | \ + * / | \ + * / | \ + * va\ | /vb + * \ | / + * \ | / + * \|/ + * v1 + */ ScalarT cotA = 0; ScalarT cotB = 0; @@ -255,16 +257,17 @@ public: template static ScalarT ComputeAngle(const VertexType * a, const VertexType * b, const VertexType * c) { - // a - // / - // / - // / - // / ___ compute the angle in b - // b \ - // \ - // \ - // \ - // c + /* a + * / + * / + * / + * / ___ compute the angle in b + * b \ + * \ + * \ + * \ + * c + */ assert(a != NULL && b != NULL && c != NULL); Point3 A,B,C; A.Import(a->P()); diff --git a/vcg/complex/algorithms/isotropic_remeshing.h b/vcg/complex/algorithms/isotropic_remeshing.h index 0d3b443d..4e726d00 100644 --- a/vcg/complex/algorithms/isotropic_remeshing.h +++ b/vcg/complex/algorithms/isotropic_remeshing.h @@ -959,20 +959,22 @@ private: return true; } - //Choose the best way to collapse a cross based on the (external) cross vertices valence - //and resulting face quality - // +0 -1 - // v1 v1 v1 - // /| \ /|\ / \ - // / | \ / | \ / \ - // / | \ / | \ / \ - // / *p| \ -1/ | \ -1 +0/ \+0 - // v0-------- v2 ========> v0 | v2 OR v0-------v2 - // \ | / \ | / \ / - // \ | / \ | / \ / - // \ | / \ | / \ / - // \ | / \|/ +0 \ / -1 - // v3 v3 v3 + /* + *Choose the best way to collapse a cross based on the (external) cross vertices valence + *and resulting face quality + * +0 -1 + * v1 v1 v1 + * /| \ /|\ / \ + * / | \ / | \ / \ + * / | \ / | \ / \ + * / *p| \ -1/ | \ -1 +0/ \+0 + * v0-------- v2 ========> v0 | v2 OR v0-------v2 + * \ | / \ | / \ / + * \ | / \ | / \ / + * \ | / \ | / \ / + * \ | / \|/ +0 \ / -1 + * v3 v3 v3 + */ static bool chooseBestCrossCollapse(PosType &p, VertexPair& bp, vector &ff) { vector vv0, vv1, vv2, vv3; diff --git a/vcg/simplex/tetrahedron/component.h b/vcg/simplex/tetrahedron/component.h index d9739658..43c7ac46 100644 --- a/vcg/simplex/tetrahedron/component.h +++ b/vcg/simplex/tetrahedron/component.h @@ -47,7 +47,7 @@ public: //Empty vertexref inline typename T::VertexType * & V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * const & V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; } - inline typename T::VertexType * const cV( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; } + inline typename T::VertexType * cV( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::CoordType & P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline const typename T::CoordType & P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } @@ -177,8 +177,8 @@ public: typedef typename T::VertexType::CoordType CoordType; typedef typename T::VertexType::ScalarType ScalarType; - inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; } - inline typename T::VertexType * const cV( const int j ) { assert(j>=0 && j<4); return v[j]; } + inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; } + inline typename T::VertexType * cV( const int j ) { assert(j>=0 && j<4); return v[j]; } inline size_t cFtoVi (const int f, const int j) const { assert(f >= 0 && f < 4); assert(j >= 0 && j < 3); return findices[f][j]; } diff --git a/vcg/space/index/grid_closest.h b/vcg/space/index/grid_closest.h index 5971ada6..0ef5f860 100644 --- a/vcg/space/index/grid_closest.h +++ b/vcg/space/index/grid_closest.h @@ -232,23 +232,30 @@ namespace vcg{ { int ix,iy,iz; for (ix=ibbox.min[0]; ix<=ibbox.max[0]; ix++) + { for (iy=ibbox.min[1]; iy<=ibbox.max[1]; iy++) + { for (iz=ibbox.min[2]; iz<=ibbox.max[2]; iz++) { _Si.Grid( ix, iy, iz, first, last ); for(l=first;l!=last;++l) + { if (!(**l).IsD()) { typename SPATIALINDEXING::ObjPtr elem=&(**l); vcg::Box3 box_elem; elem->GetBBox(box_elem); - if(( ! _marker.IsMarked(elem))&&(box_elem.Collide(_bbox))){ + if(( ! _marker.IsMarked(elem))&&(box_elem.Collide(_bbox))) + { _objectPtrs.push_back(elem); _marker.Mark(elem); } } + } } - return (static_cast(_objectPtrs.size())); + } + } + return (static_cast(_objectPtrs.size())); } } diff --git a/vcg/space/index/space_iterators.h b/vcg/space/index/space_iterators.h index 9febc6ec..65b4cd9e 100644 --- a/vcg/space/index/space_iterators.h +++ b/vcg/space/index/space_iterators.h @@ -401,7 +401,9 @@ namespace vcg{ { int ix,iy,iz; for( iz = to_explore.min.Z();iz <= to_explore.max.Z(); ++iz) + { for(iy =to_explore.min.Y(); iy <=to_explore.max.Y(); ++iy) + { for(ix =to_explore.min.X(); ix <= to_explore.max.X();++ix) { // this test is to avoid to re-process already analyzed cells. @@ -427,12 +429,13 @@ namespace vcg{ } } } - } + } + } - ////sort the elements in Elems and take a iterator to the last one - std::sort(Elems.begin(),Elems.end()); - CurrentElem=Elems.rbegin(); + ////sort the elements in Elems and take a iterator to the last one + std::sort(Elems.begin(),Elems.end()); + CurrentElem=Elems.rbegin(); return((Elems.size()==0)||(Dist()>radius)); } diff --git a/wrap/io_trimesh/import_asc.h b/wrap/io_trimesh/import_asc.h index c6e9c810..e72bec86 100644 --- a/wrap/io_trimesh/import_asc.h +++ b/wrap/io_trimesh/import_asc.h @@ -84,66 +84,66 @@ static const char *ErrorMsg(int error) */ static int Open( MESH_TYPE &m, const char * filename, CallBackPos *cb=0, bool triangulate=false, int lineskip=0) { - FILE *fp; - fp = fopen(filename, "r"); - if(fp == NULL) - { - qDebug("Failed opening of %s",filename); - return E_CANTOPEN; - } - long currentPos = ftell(fp); - fseek(fp,0L,SEEK_END); - long fileLen = ftell(fp); - fseek(fp,currentPos,SEEK_SET); + FILE *fp; + fp = fopen(filename, "r"); + if(fp == NULL) + { + qDebug("Failed opening of %s",filename); + return E_CANTOPEN; + } + long currentPos = ftell(fp); + fseek(fp,0L,SEEK_END); + long fileLen = ftell(fp); + fseek(fp,currentPos,SEEK_SET); - m.Clear(); - - Point3f pp; - float q; - size_t cnt=0; - int ret; - char buf[1024]; + m.Clear(); - // skip the first lines - for(int i=0;i lines + for(int i=0;i=3) - { - VertexIterator vi=Allocator::AddVertices(m,1); - (*vi).P().Import(pp); - if(ret==4) (*vi).Q()=q; - } - } - - fclose(fp); - if(m.vn==0) return E_NO_POINTS; - if(!triangulate) return E_NOERROR; - // now try to triangulate. - // search for the first jump - float baseY = m.vert[0].P().Y(); - int i; - for(i=1;i::FlipMesh(m); - return E_NOERROR; - } + if(ret>=3) + { + VertexIterator vi=Allocator::AddVertices(m,1); + (*vi).P().Import(pp); + if(ret==4) (*vi).Q()=q; + } + } + + fclose(fp); + if(m.vn==0) return E_NO_POINTS; + if(!triangulate) return E_NOERROR; + // now try to triangulate. + // search for the first jump + float baseY = m.vert[0].P().Y(); + unsigned int i; + for(i=1;i::FlipMesh(m); + return E_NOERROR; +} }; // end class } // end Namespace tri diff --git a/wrap/io_trimesh/import_fbx.h b/wrap/io_trimesh/import_fbx.h index 07bd8e37..424799c6 100644 --- a/wrap/io_trimesh/import_fbx.h +++ b/wrap/io_trimesh/import_fbx.h @@ -166,8 +166,9 @@ public: char buf[1024]; if (tex) { tex->getRelativeFileName().toString(buf); buf[1023] = 0; - if (std::string(buf) == "") - tex->getFileName().toString(buf); buf[1023] = 0; + if (std::string(buf) == "") { + tex->getFileName().toString(buf); buf[1023] = 0; + } printf("Texture %s\n", buf); m.textures.push_back(buf); } diff --git a/wrap/io_trimesh/import_nvm.h b/wrap/io_trimesh/import_nvm.h index 9741dca8..06f70ac5 100644 --- a/wrap/io_trimesh/import_nvm.h +++ b/wrap/io_trimesh/import_nvm.h @@ -67,10 +67,12 @@ typedef typename OpenMeshType::EdgeIterator EdgeIterator; static void readline(FILE *fp, char *line, int max=1000){ int i=0; char c; - fscanf(fp, "%c", &c); + unsigned int rc = 0; + rc = fscanf(fp, "%c", &c); while( (c!=10) && (c!=13) && (i > & shots, for(uint i = 0; i < num_points;++i,++vi){ float x,y,z; unsigned int r,g,b,i_cam, key_sift,n_corr; - fscanf(fp,"%f %f %f ",&x,&y,&z); + uint readValues = fscanf(fp,"%f %f %f ",&x,&y,&z); + if (readValues < 3) qDebug() << "Point " << i << ": only " << readValues << " coordinates read!"; (*vi).P() = vcg::Point3(x,y,z); - fscanf(fp,"%d %d %d ",&r,&g,&b); + readValues = fscanf(fp,"%d %d %d ",&r,&g,&b); + if (readValues < 3) qDebug() << "Point " << i << ": only " << readValues << " color values read!"; (*vi).C() = vcg::Color4b(r,g,b,255); - fscanf(fp,"%d ",&n_corr); + readValues = fscanf(fp,"%d ",&n_corr); + if (readValues < 1) qDebug() << "Point " << i << ": no n correspondences read!"; for(uint j = 0; j < n_corr; ++j){ - fscanf(fp,"%d %d %f %f ",&i_cam,&key_sift,&x,&y); + readValues = fscanf(fp,"%d %d %f %f ",&i_cam,&key_sift,&x,&y); + if (readValues != 3) qDebug() << "Point " << i << "; Corresp: " << j << ": only " << readValues << " values read!"; Correspondence corr(i_cam,key_sift,x,y); ch[i].push_back(corr); }