From 44eb40324ff0cb72c7e5b42145a4ec41964ea1b4 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 11 Jul 2005 13:16:34 +0000 Subject: [PATCH] small gcc-related compiling issues (typenames,ending cr, initialization order) --- vcg/complex/trimesh/create/platonic.h | 75 ++++++++++++++++----------- vcg/complex/trimesh/refine.h | 32 +++++++----- vcg/complex/trimesh/smooth.h | 53 +++++++++++++------ vcg/container/simple_temporary_data.h | 10 ++-- vcg/math/camera.h | 5 +- vcg/math/shot.h | 5 +- 6 files changed, 113 insertions(+), 67 deletions(-) diff --git a/vcg/complex/trimesh/create/platonic.h b/vcg/complex/trimesh/create/platonic.h index 3faa108b..8967da78 100644 --- a/vcg/complex/trimesh/create/platonic.h +++ b/vcg/complex/trimesh/create/platonic.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.4 2005/07/01 11:17:06 cignoni +Added option of passing a base mesh to Sphere for spherifying it + Revision 1.3 2005/06/17 00:49:29 cignoni Added missing Sphere function @@ -81,22 +84,23 @@ template void Tetrahedron(TetraMeshType &in) { typedef TetraMeshType MeshType; - typedef typename MeshType::CoordType CoordType; - typedef typename MeshType::VertexPointer VertexPointer; - typedef typename MeshType::VertexIterator VertexIterator; - typedef typename MeshType::FaceIterator FaceIterator; + typedef typename TetraMeshType::CoordType CoordType; + typedef typename TetraMeshType::VertexPointer VertexPointer; + typedef typename TetraMeshType::VertexIterator VertexIterator; + typedef typename TetraMeshType::FaceIterator FaceIterator; in.Clear(); Allocator::AddVertices(in,4); Allocator::AddFaces(in,4); VertexPointer ivp[4]; - + CoordType test; +test=CoordType ( 1.0, 1.0, 1.0); VertexIterator vi=in.vert.begin(); - ivp[0]=&*vi;(*vi).P()=TetraMeshType::CoordType ( 1, 1, 1); ++vi; - ivp[1]=&*vi;(*vi).P()=TetraMeshType::CoordType (-1, 1,-1); ++vi; - ivp[2]=&*vi;(*vi).P()=TetraMeshType::CoordType (-1,-1, 1); ++vi; - ivp[3]=&*vi;(*vi).P()=TetraMeshType::CoordType ( 1,-1,-1); + ivp[0]=&*vi;(*vi).P()=CoordType ( 1.0, 1.0, 1.0); ++vi; + ivp[1]=&*vi;(*vi).P()=CoordType (-1.0, 1.0,-1.0); ++vi; + ivp[2]=&*vi;(*vi).P()=CoordType (-1.0,-1.0, 1.0); ++vi; + ivp[3]=&*vi;(*vi).P()=CoordType ( 1.0,-1.0,-1.0); FaceIterator fi=in.face.begin(); (*fi).V(0)=ivp[0]; (*fi).V(1)=ivp[1]; (*fi).V(2)=ivp[2]; ++fi; @@ -117,8 +121,8 @@ void Dodecahedron(DodMeshType & in) typedef typename MeshType::VertexIterator VertexIterator; typedef typename MeshType::FaceIterator FaceIterator; typedef typename MeshType::ScalarType ScalarType; - const N_penta=12; - const N_points=62; + const int N_penta=12; + const int N_points=62; int penta[N_penta*3*3]= {20,11, 18, 18, 11, 8, 8, 11, 4, @@ -194,7 +198,7 @@ void Dodecahedron(DodMeshType & in) added[ i ] = m++; } - vector index(in.vn); + std::vector index(in.vn); for(j=0,vi=in.vert.begin();j -void Sphere(MESH_TYPE &in, const int subdiv = 3 ) +template +void Sphere(MeshType &in, const int subdiv = 3 ) { + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; if(in.vn==0 && in.fn==0) Icosahedron(in); - MESH_TYPE::VertexIterator vi; + VertexIterator vi; for(vi = in.vert.begin(); vi!=in.vert.end();++vi) vi->P().Normalize(); - tri::UpdateFlags::FaceBorderFromNone(in); + tri::UpdateFlags::FaceBorderFromNone(in); int lastsize = 0; for(int i=0;i >(in,MidPoint(),0); + Refine >(in,MidPoint(),0); for(vi = in.vert.begin()+lastsize;vi!=in.vert.end();++vi) vi->P().Normalize(); @@ -547,39 +556,45 @@ void Box(MeshType &in, const typename MeshType::BoxType & bb ) /// Questa funzione costruisce una mesh a partire da un insieme di coordiante /// ed un insieme di terne di indici di vertici -template -void Build( M & in, const V & v, const F & f) +template +void Build( MeshType & in, const V & v, const F & f) { - in.vn = v.size(); + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; + typedef typename MeshType::VertexPointer VertexPointer; + typedef typename MeshType::VertexIterator VertexIterator; + typedef typename MeshType::FaceIterator FaceIterator; + + in.vn = v.size(); in.fn = f.size(); in.vert.clear(); in.face.clear(); - V::const_iterator vi; + typename V::const_iterator vi; - M::VertexType tv; + typename MeshType::VertexType tv; tv.Supervisor_Flags()=0; for(vi=v.begin();vi!=v.end();++vi) { - tv.P() = M::CoordType( - (M::ScalarType)(*vi).Ext(0), - (M::ScalarType)(*vi).Ext(1), - (M::ScalarType)(*vi).Ext(2) + tv.P() = CoordType( + (ScalarType)(*vi).Ext(0), + (ScalarType)(*vi).Ext(1), + (ScalarType)(*vi).Ext(2) ); in.vert.push_back(tv); } - vector index(in.vn); - M::vertex_iterator j; + std::vector index(in.vn); + VertexIterator j; int k; for(k=0,j=in.vert.begin();j!=in.vert.end();++j,++k) index[k] = &*j; - F::const_iterator fi; + typename F::const_iterator fi; - M::face_type ft; + typename MeshType::FaceType ft; ft.Supervisor_Flags()=0; for(fi=f.begin();fi!=f.end();++fi) diff --git a/vcg/complex/trimesh/refine.h b/vcg/complex/trimesh/refine.h index d94870bc..aad013c5 100644 --- a/vcg/complex/trimesh/refine.h +++ b/vcg/complex/trimesh/refine.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.5 2005/06/29 15:25:41 callieri +deleted a wrong declaration "typename typename" + Revision 1.4 2005/06/17 00:48:27 cignoni Corrected the type name of wedge tex coords WedgeInterp in RefineE @@ -50,6 +53,7 @@ first working version #include #include #include +#include #include namespace vcg{ @@ -297,10 +301,10 @@ template bool RefineE(MESH_TYPE &m, MIDPOINT mid, EDGEPRED ep,bool RefineSelected=false) { int j,NewVertNum=0,NewFaceNum=0; - typedef std::pair vvpair; - std::map Edge2Vert; + typedef std::pair vvpair; + std::map Edge2Vert; // Primo ciclo si conta quanti sono i vertici e facce da aggiungere - MESH_TYPE::FaceIterator fi; + typename MESH_TYPE::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) if(!(*fi).IsD()) for(j=0;j<3;j++){ if(ep((*fi).V(j)->P(),(*fi).V1(j)->P()) && @@ -325,7 +329,7 @@ bool RefineE(MESH_TYPE &m, MIDPOINT mid, EDGEPRED ep,bool RefineSelected=false) (*lastv).UberFlags()=0; mid( (*lastv), face::Pos (&*fi,j)); //(*lastv).P()=((*fi).V(j)->P()+(*fi).V1(j)->P())/2; - Edge2Vert[ vvpair((*fi).V(j),(*fi).V1(j)) ] = lastv; + Edge2Vert[ vvpair((*fi).V(j),(*fi).V1(j)) ] = &*lastv; ++lastv; } assert(lastv==m.vert.end()); @@ -350,10 +354,10 @@ bool RefineE(MESH_TYPE &m, MIDPOINT mid, EDGEPRED ep,bool RefineSelected=false) */ - typename MESH_TYPE::VertexIterator vv[6]; // i sei vertici in gioco + typename MESH_TYPE::VertexPointer vv[6]; // i sei vertici in gioco // 0..2 vertici originali del triangolo // 3..5 mp01, mp12, mp20 midpoints of the three edges - MESH_TYPE::FaceIterator nf[4]; // le quattro facce in gioco. + typename MESH_TYPE::FacePointer nf[4]; // le quattro facce in gioco. typename MESH_TYPE::FaceType::TexCoordType wtt[6]; // per ogni faccia sono al piu' tre i nuovi valori // di texture per wedge (uno per ogni edge) @@ -382,10 +386,10 @@ bool RefineE(MESH_TYPE &m, MIDPOINT mid, EDGEPRED ep,bool RefineSelected=false) else vv[5]=0; int ind=((&*vv[3])?1:0)+((&*vv[4])?2:0)+((&*vv[5])?4:0); - nf[0]=fi; - static int iii=0; - for(int i=1;i he(ep.f,ep.z,ep.f->V(ep.z)); +face::Pos he(ep.f,ep.z,ep.f->V(ep.z)); typename MESH_TYPE::CoordType *vl,*vr; vl=&he.v->P(); vr=&he.VFlip()->P(); @@ -609,7 +613,7 @@ double Rules[11][10] = int kl=0,kr=0; // valence of left and right vertices bool bl=false,br=false; // if left and right vertices are of border - Pos heStart=he;assert(he.v->P()==*vl); + face::Pos heStart=he;assert(he.v->P()==*vl); do { // compute valence of left vertex he.FlipE();he.FlipF(); if(he.IsBorder()) bl=true; @@ -763,4 +767,4 @@ class EdgeSplSphere -#endif \ No newline at end of file +#endif diff --git a/vcg/complex/trimesh/smooth.h b/vcg/complex/trimesh/smooth.h index 12d0dd66..0ff0bce2 100644 --- a/vcg/complex/trimesh/smooth.h +++ b/vcg/complex/trimesh/smooth.h @@ -23,11 +23,27 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.2 2005/03/16 16:14:12 spinelli +aggiunta funzione PasoDobleSmooth e relative: + +- FitMesh +- FaceErrorGrad +- CrossProdGradient +- TriAreaGradient +- NormalSmooth + +e le classi: + +- PDVertInfo +- PDFaceInfo + +necessarie per utilizzare SimpleTempData + Revision 1.1 2004/12/11 14:53:19 ganovelli first partial porting: compiled gcc,intel and msvc -/****************************************************************************/ +****************************************************************************/ #ifndef __VCGLIB__SMOOTH @@ -36,6 +52,7 @@ first partial porting: compiled gcc,intel and msvc #include #include #include +#include namespace vcg { @@ -534,7 +551,7 @@ void NormalSmooth(MESH_TYPE &m, vcg::face::VFIterator ep; - MESH_TYPE::FaceIterator fi; + typename MESH_TYPE::FaceIterator fi; for(fi=m.face.begin();fi!=m.face.end();++fi) { @@ -645,13 +662,13 @@ Point3 FaceErrorGrad(Point3 &p,Point3 &p0,Point3 &p1, Point3 template void FitMesh(MESH_TYPE &m, - SimpleTempData > &TDV, - SimpleTempData > &TDF, + SimpleTempData > &TDV, + SimpleTempData > &TDF, float lambda) { //vcg::face::Pos ep; vcg::face::VFIterator ep; - MESH_TYPE::VertexIterator vi; + typename MESH_TYPE::VertexIterator vi; for(vi=m.vert.begin();vi!=m.vert.end();++vi) { Point3f ErrGrad=Point3f(0,0,0); @@ -680,17 +697,19 @@ void FitMesh(MESH_TYPE &m, -template -void PasoDobleSmooth(MESH_TYPE &m, int step, typename MESH_TYPE::ScalarType Sigma=0, int FitStep=10, typename MESH_TYPE::ScalarType FitLambda=0.05) +template +void PasoDobleSmooth(MeshType &m, int step, typename MeshType::ScalarType Sigma=0, int FitStep=10, typename MeshType::ScalarType FitLambda=0.05) { + typedef typename MeshType::ScalarType ScalarType; + typedef typename MeshType::CoordType CoordType; - SimpleTempData< typedef MESH_TYPE::VertContainer, PDVertInfo > TDV(m.vert); - SimpleTempData< typedef MESH_TYPE::FaceContainer, PDFaceInfo > TDF(m.face); - PDVertInfo lpzv; - lpzv.np=typename MESH_TYPE::CoordType(0,0,0); - PDFaceInfo lpzf; - lpzf.m=typename MESH_TYPE::CoordType(0,0,0); + SimpleTempData< typename MeshType::VertContainer, PDVertInfo > TDV(m.vert); + SimpleTempData< typename MeshType::FaceContainer, PDFaceInfo > TDF(m.face); + PDVertInfo lpzv; + lpzv.np=CoordType(0,0,0); + PDFaceInfo lpzf; + lpzf.m=CoordType(0,0,0); assert(m.HasVFTopology()); m.HasVFTopology(); @@ -699,10 +718,10 @@ void PasoDobleSmooth(MESH_TYPE &m, int step, typename MESH_TYPE::ScalarType Sigm for(int j=0;j::PerFace(m); - NormalSmooth(m,TDF,Sigma); + vcg::tri::UpdateNormals::PerFace(m); + NormalSmooth(m,TDF,Sigma); for(int k=0;k(m,TDV,TDF,FitLambda); + FitMesh(m,TDV,TDF,FitLambda); } TDF.Stop(); @@ -714,4 +733,4 @@ void PasoDobleSmooth(MESH_TYPE &m, int step, typename MESH_TYPE::ScalarType Sigm } // End namespace vcg -#endif // VCG_SMOOTH \ No newline at end of file +#endif // VCG_SMOOTH diff --git a/vcg/container/simple_temporary_data.h b/vcg/container/simple_temporary_data.h index ede41197..5b629aff 100644 --- a/vcg/container/simple_temporary_data.h +++ b/vcg/container/simple_temporary_data.h @@ -24,11 +24,14 @@ History $Log: not supported by cvs2svn $ +Revision 1.3 2004/12/11 15:37:47 ganovelli +added one more [], now it is polymorphic, added typenames + Revision 1.2 2004/03/31 22:36:44 ganovelli First Working Release (with this comment) -/****************************************************************************/ +****************************************************************************/ #ifndef __VCGLIB_SIMPLE__ #define __VCGLIB_SIMPLE__ @@ -40,7 +43,6 @@ namespace vcg { template class SimpleTempData{ public: -typedef typename ATTR_TYPE attr_type; STL_CONT& c; std::vector data; @@ -57,7 +59,7 @@ void Start(){data.reserve(c.capacity());data.resize(c.size());} // start and initialize temporary attribute void Start(ATTR_TYPE val){data.reserve(c.capacity());data.resize(c.size()); - std::vector::iterator i; + typename std::vector::iterator i; for(i = data.begin(); i!= data.end(); ++i) *i = val; } @@ -78,4 +80,4 @@ bool UpdateSize(){ }; // end namespace vcg -#endif \ No newline at end of file +#endif diff --git a/vcg/math/camera.h b/vcg/math/camera.h index 9a56cf50..b60f0fff 100644 --- a/vcg/math/camera.h +++ b/vcg/math/camera.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.21 2005/07/01 10:55:42 cignoni +Removed default values from the implementation of SetCavalieri and SetIsometric + Revision 1.20 2005/06/29 14:59:03 spinelli aggiunto: - l' enum dei tipi PERSPECTIVE, ORTHO, ISOMETRIC, CAVALIERI @@ -123,7 +126,7 @@ public: f(0.f),s(vcg::Point2(0.0,0.0)), c(vcg::Point2(0.0,0.0)), viewport(vcg::Point2(0,0)), - _flags(0),viewportM(1), cameraType(0) + viewportM(1),_flags(0), cameraType(0) {} S f; // Focal Distance (cioe' la distanza del piano immagine dal centro di proiezione diff --git a/vcg/math/shot.h b/vcg/math/shot.h index 88a311c6..96ff51ae 100644 --- a/vcg/math/shot.h +++ b/vcg/math/shot.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.11 2005/01/22 11:20:20 ponchio +<...Point3.h> -> <...point3.h> + Revision 1.10 2005/01/05 13:26:15 ganovelli corretto cambiamento di sistema di rif. @@ -47,7 +50,7 @@ Revision 1.2 2004/09/06 21:41:30 ganovelli Revision 1.1 2004/09/03 13:01:51 ganovelli creation -/****************************************************************************/ +****************************************************************************/ #ifndef __VCGLIB_SHOT