From 0bbd5bb33b2d524c064f0812bee79b17ead408c8 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Wed, 25 Aug 2004 15:15:27 +0000 Subject: [PATCH] minor changes to comply gcc compiler (typename's and stuff) --- apps/metro/sampling.h | 5 +- vcg/complex/trimesh/allocate.h | 5 +- vcg/complex/trimesh/clean.h | 15 +++-- vcg/complex/trimesh/update/color.h | 97 +++++++++++++++++------------- vcg/math/histogram.h | 5 +- vcg/simplex/face/base.h | 9 ++- vcg/simplex/face/pos.h | 11 ++-- vcg/simplex/vertex/base.h | 12 +++- wrap/io_trimesh/import_stl.h | 6 +- 9 files changed, 102 insertions(+), 63 deletions(-) diff --git a/apps/metro/sampling.h b/apps/metro/sampling.h index e5f3cdde..8fbe6f46 100644 --- a/apps/metro/sampling.h +++ b/apps/metro/sampling.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.9 2004/07/18 10:13:34 cignoni +NewUserBit -> NewBitFlag + Revision 1.8 2004/06/24 09:08:31 cignoni Official Release of Metro 4.00 @@ -264,7 +267,7 @@ void Sampling::VertexSampling() printf("Vertex sampling\n"); VertexIterator vi; - std::vector::iterator vif; + typename std::vector::iterator vif; for(vi=S1.vert.begin();vi!=S1.vert.end();++vi) if( (*vi).IsUserBit(referredBit) || // it is referred ((Flags&SamplingFlags::INCLUDE_UNREFERENCED_VERTICES) != 0) ) //include also unreferred diff --git a/vcg/complex/trimesh/allocate.h b/vcg/complex/trimesh/allocate.h index 98cf42d1..ed28a897 100644 --- a/vcg/complex/trimesh/allocate.h +++ b/vcg/complex/trimesh/allocate.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.11 2004/08/07 17:38:00 pietroni +solved errors on AddFaces relative to VFp pointers of faces + Revision 1.10 2004/08/07 16:16:32 pietroni corrected errors in AddFaces ( must be updated pointers to chain of faces of VFTopology) @@ -200,7 +203,7 @@ static FaceIterator AddFaces(MeshType &m, int n, PointerUpdater &pu pu.Update((FacePointer&)(*it)); }*/ - std::vector::iterator jit; + typename std::vector::iterator jit; for(jit=local_var.begin(); jit!=local_var.end(); ++jit) if((**jit) !=0 ) { diff --git a/vcg/complex/trimesh/clean.h b/vcg/complex/trimesh/clean.h index 53b1bf8b..c9b2ecdd 100644 --- a/vcg/complex/trimesh/clean.h +++ b/vcg/complex/trimesh/clean.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2004/07/18 06:55:37 cignoni +NewUserBit -> NewBitFlag + Revision 1.2 2004/07/09 15:48:37 tarini Added an include () @@ -73,17 +76,17 @@ static int RemoveDuplicateVertex( MeshType & m ) // V1.0 { if(m.vert.size()==0 || m.vn==0) return 0; - std::map mp; + std::map mp; int i,j; VertexIterator vi; int deleted=0; int k=0; int num_vert = m.vert.size(); - vector perm(num_vert); + vector perm(num_vert); for(vi=m.vert.begin(); vi!=m.vert.end(); ++vi, ++k) - perm[k] = vi; + perm[k] = &(*vi); - RemoveDuplicateVert_Compare c_obj; + RemoveDuplicateVert_Compare c_obj; std::sort(perm.begin(),perm.end(),c_obj); @@ -97,7 +100,7 @@ static int RemoveDuplicateVertex( MeshType & m ) // V1.0 (! (*perm[j]).IsD()) && (*perm[i]).P() == (*perm[j]).cP() ) { - VertexIterator t = perm[i]; + VertexPointer t = perm[i]; mp[perm[i]] = perm[j]; ++i; (*t).SetD(); @@ -113,7 +116,7 @@ static int RemoveDuplicateVertex( MeshType & m ) // V1.0 for(fi = m.face.begin(); fi!=m.face.end(); ++fi) for(k = 0; k < 3; ++k) if( !(*fi).IsD() ) - if( mp.find( (*fi).V(k) ) != mp.end() ) + if( mp.find( (typename MeshType::VertexPointer)(*fi).V(k) ) != mp.end() ) { (*fi).V(k) = &*mp[ (*fi).V(k) ]; } diff --git a/vcg/complex/trimesh/update/color.h b/vcg/complex/trimesh/update/color.h index 1a82803c..ddb71723 100644 --- a/vcg/complex/trimesh/update/color.h +++ b/vcg/complex/trimesh/update/color.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2004/07/15 00:13:39 cignoni +Better doxigen documentation + Revision 1.4 2004/06/24 07:56:54 cignoni now use std::numeric_limits instead of old max val() @@ -52,25 +55,25 @@ template class UpdateColor { public: -typedef UpdateMeshType MeshType; -typedef typename MeshType::VertexType VertexType; -typedef typename MeshType::VertexPointer VertexPointer; -typedef typename MeshType::VertexIterator VertexIterator; -typedef typename MeshType::FaceType FaceType; -typedef typename MeshType::FacePointer FacePointer; -typedef typename MeshType::FaceIterator FaceIterator; +typedef UpdateMeshType MeshType; +typedef typename UpdateMeshType::VertexType VertexType; +typedef typename UpdateMeshType::VertexPointer VertexPointer; +typedef typename UpdateMeshType::VertexIterator VertexIterator; +typedef typename UpdateMeshType::FaceType FaceType; +typedef typename UpdateMeshType::FacePointer FacePointer; +typedef typename UpdateMeshType::FaceIterator FaceIterator; /** Color the vertex of the mesh that are on the border It uses the information in the flags, and not any topology. So it just require that you have correctly computed (or loaded) the flags; See the **/ -static void VertexBorderFlag(MeshType &m, Color4b vb=Color4b::Blue) +static void VertexBorderFlag( UpdateMeshType &m, Color4b vb=Color4b::Blue) { - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).C()=Color4b::White; - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) for(int j=0;j<3;++j) if((*fi).IsB(j)){ @@ -80,10 +83,10 @@ static void VertexBorderFlag(MeshType &m, Color4b vb=Color4b::Blue) } } -static void FaceBF(MeshType &m, Color4b vn=Color4b::White, Color4b vb=Color4b::Blue, +static void FaceBF( UpdateMeshType &m, Color4b vn=Color4b::White, Color4b vb=Color4b::Blue, Color4b vc=Color4b::Red, Color4b vs=Color4b::LightBlue) { - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) (*fi).C() = vn; @@ -96,7 +99,7 @@ static void FaceBF(MeshType &m, Color4b vn=Color4b::White, Color4b vb=Color4b::B else { for(int j=0;j<3;++j) - if(face::IsManifold(*fi,j)){ + if(*fi.IsManifold(j)){ if((*fi).IsB(j)){ (*fi).C() = vb; (*fi).C() = vb; @@ -112,10 +115,10 @@ static void FaceBF(MeshType &m, Color4b vn=Color4b::White, Color4b vb=Color4b::B } -static int FaceSelected(MeshType &m, Color4b vs=Color4b::LightBlue) +static int FaceSelected(UpdateMeshType &m, Color4b vs=Color4b::LightBlue) { int cnt=0; - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) if((*fi).IsS()) { (*fi).C() = vs; ++cnt; } @@ -123,12 +126,20 @@ static int FaceSelected(MeshType &m, Color4b vs=Color4b::LightBlue) return cnt; } -static void FaceColorStrip(MeshType &m, std::vector &TStripF) +static void FaceColorStrip(UpdateMeshType &m, std::vector &TStripF) { - Color4b::Color4b cc[7]={Color4b::White ,Color4b::Red ,Color4b::Green ,Color4b::Blue ,Color4b::Cyan ,Color4b::Yellow ,Color4b::Magenta}; + vcg::Color4b cc[7]={ + vcg::Color4b::White , + vcg::Color4b::Red , + vcg::Color4b::Green , + vcg::Color4b::Blue , + vcg::Color4b::Cyan , + vcg::Color4b::Yellow , + vcg::Color4b::Magenta + }; int cnt=0; - vector::iterator fi; + typename std::vector::iterator fi; for(fi=TStripF.begin();fi!=TStripF.end();++fi) if(*fi) (**fi).C().ColorRamp(0,16,cnt); else cnt=(cnt+1)%16; @@ -138,10 +149,10 @@ static void FaceColorStrip(MeshType &m, std::vector &TStripF) } -static int VertexSelected(MeshType &m, Color4b vs=Color4b::LightBlue) +static int VertexSelected(UpdateMeshType &m, Color4b vs=Color4b::LightBlue) { int cnt=0; - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) if((*vi).IsS()) {(*vi).C() = vs; ++cnt; } @@ -150,27 +161,27 @@ static int VertexSelected(MeshType &m, Color4b vs=Color4b::LightBlue) return cnt; } -static void VertexConstant(MeshType &m, Color4b c=Color4b::White) +static void VertexConstant(UpdateMeshType &m, Color4b c=Color4b::White) { - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).C()=c; } -static void FaceConstant(MeshType &m, Color4b c=Color4b::White) +static void FaceConstant(UpdateMeshType &m, Color4b c=Color4b::White) { - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) (*fi).C()=c; } -static void VertexBorderManifoldFlag(MeshType &m, Color4b vn=Color4b::White, Color4b vb=Color4b::Blue, Color4b vc=Color4b::Red) +static void VertexBorderManifoldFlag(UpdateMeshType &m, Color4b vn=Color4b::White, Color4b vb=Color4b::Blue, Color4b vc=Color4b::Red) { - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).C()=vn; - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) for(int j=0;j<3;++j) @@ -189,10 +200,10 @@ static void VertexBorderManifoldFlag(MeshType &m, Color4b vn=Color4b::White, Col -static void FaceQuality(MeshType &m) +static void FaceQuality(UpdateMeshType &m) { // step 1: find the range - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; float minq=m.face[0].Q(), maxq=m.face[0].Q(); for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) @@ -205,27 +216,27 @@ static void FaceQuality(MeshType &m) FaceQuality(m,minq,maxq); } -static void FaceQuality(MeshType &m, float minq, float maxq) +static void FaceQuality(UpdateMeshType &m, float minq, float maxq) { - MeshType::FaceIterator fi; + typename UpdateMeshType::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) (*fi).C().ColorRamp(minq,maxq,(*fi).Q()); } -static void VertexQuality(MeshType &m, float minq, float maxq) +static void VertexQuality(UpdateMeshType &m, float minq, float maxq) { - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) if(!(*vi).IsD()) (*vi).C().ColorRamp(minq,maxq,(*vi).Q()); } -static void VertexQuality(MeshType &m) +static void VertexQuality(UpdateMeshType &m) { // step 1: find the range - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; float minq=std::numeric_limits::max(), maxq=std::numeric_limits::min(); for(vi=m.vert.begin();vi!=m.vert.end();++vi) @@ -237,10 +248,10 @@ static void VertexQuality(MeshType &m) VertexQuality(m,minq,maxq); } -static void VertexQualityHistEq(MeshType &m) +static void VertexQualityHistEq(UpdateMeshType &m) { // step 1: find the range - MeshType::VertexIterator vi; + typename UpdateMeshType::VertexIterator vi; float minq=MaxVal(0.0f), maxq=-MaxVal(0.0f); for(vi=m.vert.begin();vi!=m.vert.end();++vi) @@ -250,16 +261,16 @@ static void VertexQualityHistEq(MeshType &m) maxq=max(maxq,(*vi).Q()); } // step 2; Get the distribution - Hist H; - H.SetRange(minq,maxq,1024); - for(vi=m.vert.begin();vi!=m.vert.end();++vi) - if(!(*vi).IsD()) H.Add((*vi).Q()); + // Hist H; + //H.SetRange(minq,maxq,1024); + //for(vi=m.vert.begin();vi!=m.vert.end();++vi) + // if(!(*vi).IsD()) H.Add((*vi).Q()); - VertexQuality(m,H.Percentile(.05f),H.Percentile(.95f)); + // VertexQuality(m,H.Percentile(.05f),H.Percentile(.95f)); } }; /*@}*/ }// end namespace }// end namespace -#endif \ No newline at end of file +#endif diff --git a/vcg/math/histogram.h b/vcg/math/histogram.h index 323b2a18..f8fb8378 100644 --- a/vcg/math/histogram.h +++ b/vcg/math/histogram.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.1 2004/06/24 09:12:28 cignoni +Initial Release + ****************************************************************************/ @@ -115,4 +118,4 @@ void Histogram::Add(ScalarType v){ } } }// end namespace -#endif \ No newline at end of file +#endif diff --git a/vcg/simplex/face/base.h b/vcg/simplex/face/base.h index c3fcd6b5..ef738914 100644 --- a/vcg/simplex/face/base.h +++ b/vcg/simplex/face/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.17 2004/07/15 12:03:07 ganovelli +minor changes + Revision 1.16 2004/07/15 11:31:59 ganovelli minor changes @@ -145,7 +148,7 @@ public: return v[j]; } - inline const FVTYPE * const & V( const int j ) const + inline FVTYPE * const & V( const int j ) const { assert( (_flags & DELETED) == 0 ); assert( (_flags & NOTREAD) == 0 ); @@ -153,7 +156,7 @@ public: assert(j<3); return v[j]; } - inline const FVTYPE * const & cV( const int j ) const + inline FVTYPE * const cV( const int j ) const { assert( (_flags & DELETED) == 0 ); assert( (_flags & NOTREAD) == 0 ); @@ -1092,7 +1095,7 @@ const ScalarType EPSILON = ScalarType(0.000001); /// Return the DOUBLE of the area of the face ScalarType Area() const { - return Norm( (V(1)->P() - V(0)->P()) ^ (V(2)->P() - V(0)->P()) ); + return ( (V(1)->cP() - V(0)->cP()) ^ (V(2)->cP() - V(0)->P()) ).Norm(); } CoordType Barycenter() const diff --git a/vcg/simplex/face/pos.h b/vcg/simplex/face/pos.h index fb7abf13..b90efbb1 100644 --- a/vcg/simplex/face/pos.h +++ b/vcg/simplex/face/pos.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.10 2004/07/27 09:47:49 cignoni +Added V() access function instead of V(0) + Revision 1.9 2004/07/18 07:45:30 cignoni Removed two const modifiers from the VFIterator @@ -327,7 +330,7 @@ public: This class is used as an iterator over the VF adjacency. */ -template +template class VFIterator { public: @@ -335,14 +338,14 @@ public: /// The vertex type typedef typename FaceType::VertexType VertexType; /// The Base face type - typedef typename FaceType VFIFaceType; + typedef FaceType VFIFaceType; /// The vector type typedef typename VertexType::CoordType CoordType; /// The scalar type typedef typename VertexType::ScalarType ScalarType; /// Pointer to the face of the half-edge - VFIFaceType *f; + FaceType *f; /// Index of the vertex int z; @@ -352,7 +355,7 @@ public: VFIterator(FaceType * _f, const int & _z){f = _f; z = _z;} VFIFaceType * F() const { return f;} - const int I() const { return z;} + const int & I() const { return z;} bool End() const {return f==0;} VFIFaceType *operator++() { diff --git a/vcg/simplex/vertex/base.h b/vcg/simplex/vertex/base.h index c9348709..99c9ed37 100644 --- a/vcg/simplex/vertex/base.h +++ b/vcg/simplex/vertex/base.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.17 2004/07/20 15:24:53 pietroni +corrected NormalizedNormalV function... + Revision 1.16 2004/07/15 11:25:01 ganovelli VFb moved to VFp, userbit to bitflag,setV, inclusion of pos.h @@ -42,6 +45,9 @@ Revision 1.12 2004/05/10 13:31:13 ganovelli function for edge adjacency added $Log: not supported by cvs2svn $ +Revision 1.17 2004/07/20 15:24:53 pietroni +corrected NormalizedNormalV function... + Revision 1.16 2004/07/15 11:25:01 ganovelli VFb moved to VFp, userbit to bitflag,setV, inclusion of pos.h @@ -840,10 +846,10 @@ template typename VERTEX_TYPE::CoordType NormalizedNormalV(V } else { - vcg::face::VFIterator VFi=vcg::face::VFIterator(); + vcg::face::VFIterator VFi=vcg::face::VFIterator(); VFi.f=v->VFp(); VFi.z=v->VFi(); - VERTEX_TYPE::CoordType N=VERTEX_TYPE::CoordType(0,0,0); + typename VERTEX_TYPE::CoordType N= typename VERTEX_TYPE::CoordType(0,0,0); int i=0; while (!VFi.End()) { @@ -851,7 +857,7 @@ template typename VERTEX_TYPE::CoordType NormalizedNormalV(V i++; VFi++; } - return ((VERTEX_TYPE::CoordType) N/(VERTEX_TYPE::CoordType::ScalarType)i); + return ((typename VERTEX_TYPE::CoordType) N/(typename VERTEX_TYPE::CoordType::ScalarType)i); } } diff --git a/wrap/io_trimesh/import_stl.h b/wrap/io_trimesh/import_stl.h index 67e1add2..d962ebe8 100644 --- a/wrap/io_trimesh/import_stl.h +++ b/wrap/io_trimesh/import_stl.h @@ -25,6 +25,10 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2004/06/23 15:36:44 cignoni +Restructured management of error, now the standard open for any mesh type return the error code, the default success value is zero +Any import class has a method ErrorMsg that give a verbal description of an error code. + Revision 1.4 2004/03/18 15:30:57 cignoni Removed float/double warning @@ -210,4 +214,4 @@ static int OpenBinary( OpenMeshType &m, const char * filename, CallBackPos *cb=0 //@} -#endif \ No newline at end of file +#endif