From f73fa193461175e08bc1f75d613c0ca310d89edb Mon Sep 17 00:00:00 2001 From: ganovelli Date: Mon, 12 Dec 2005 11:15:26 +0000 Subject: [PATCH] modifications to compile with gcc --- .../local_optimization/tetra_edge_collapse.h | 17 +++++---- vcg/complex/tetramesh/base.h | 5 ++- vcg/complex/tetramesh/edge_collapse.h | 30 +++++++-------- vcg/complex/tetramesh/update/normal.h | 6 ++- vcg/complex/tetramesh/update/topology.h | 6 +-- vcg/complex/tetramesh/update/triconvert.h | 7 ++-- vcg/simplex/tetrahedron/base.h | 9 +++-- vcg/simplex/tetrahedron/pos.h | 37 ++++++++++--------- vcg/space/tetra3.h | 9 +++-- 9 files changed, 71 insertions(+), 55 deletions(-) diff --git a/vcg/complex/local_optimization/tetra_edge_collapse.h b/vcg/complex/local_optimization/tetra_edge_collapse.h index e0bba50e..a35b3855 100644 --- a/vcg/complex/local_optimization/tetra_edge_collapse.h +++ b/vcg/complex/local_optimization/tetra_edge_collapse.h @@ -27,7 +27,11 @@ #ifndef __VCG_DECIMATION_COLLAPSE #define __VCG_DECIMATION_COLLAPSE -#include +#include +#include +#include +#include + struct FAIL{ static int VOL(){static int vol=0; return vol++;} @@ -74,7 +78,7 @@ class TetraEdgeCollapse: public LocalOptimization::LocModType private: ///the new point that substitute the edge -Point<3,ScalarType> _NewPoint; +Point3 _NewPoint; ///the pointer to edge collapser method vcg::tetra::EdgeCollapse _EC; ///mark for up_dating @@ -154,7 +158,7 @@ ScalarType _VolumePreservingError(PosType &pos,CoordType &new_point,int nsteps) for (int i=0;icP()*alfatemp; @@ -238,7 +242,7 @@ public: bool IsUpToDate(){ if (!pos.T()->IsD()) - { + { VertexType *v0=pos.T()->V(Tetra::VofE(pos.E(),0)); VertexType *v1=pos.T()->V(Tetra::VofE(pos.E(),1)); assert(!v0->IsD()); @@ -247,13 +251,13 @@ public: _Imark()>=v0->IMark() && _Imark()>=v1->IMark())) { - FAIL::OFD(); + FAIL::OFD(); return false; } else return true; } - else + else return false; } @@ -265,7 +269,6 @@ public: static void Init(TETRA_MESH_TYPE &m,typename LocalOptimization::HeapType& h_ret){ h_ret.clear(); typename TETRA_MESH_TYPE::TetraIterator ti; - int j; for(ti = m.tetra.begin(); ti != m.tetra.end();++ti) if(!(*ti).IsD()){ (*ti).ComputeVolume(); diff --git a/vcg/complex/tetramesh/base.h b/vcg/complex/tetramesh/base.h index 9b38da76..5a658d05 100644 --- a/vcg/complex/tetramesh/base.h +++ b/vcg/complex/tetramesh/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.11 2005/01/12 11:06:54 ganovelli +added InitVertexIMark + Revision 1.10 2004/10/11 17:44:07 ganovelli added include of color4 @@ -179,7 +182,7 @@ class Tetramesh{ inline int MemUsed() const { - return sizeof(TMTYPE)+sizeof(VertexType)*vert.size()+sizeof(tetrahedron)*tetra.size()+sizeof(edge)*edges.size(); + return sizeof(Tetramesh)+sizeof(VertexType)*vert.size()+sizeof(TetraType)*tetra.size(); } void Clear(){ diff --git a/vcg/complex/tetramesh/edge_collapse.h b/vcg/complex/tetramesh/edge_collapse.h index fc59eeb6..9656ea2b 100644 --- a/vcg/complex/tetramesh/edge_collapse.h +++ b/vcg/complex/tetramesh/edge_collapse.h @@ -271,7 +271,7 @@ static int _Collapse(PosType p,CoordType NewP) } //delting old tetrahedrons - vector::iterator ti; + typename vector::iterator ti; for (ti=To_Del.begin();tiSetD(); @@ -322,7 +322,7 @@ static bool isMarkedE(Edge E,char M) EI=_EdgeMark().find(E); if (EI==_EdgeMark().end()) return false; - else return ((*EI).second & M); + else return (((*EI).second & M)!=0); } static void orMarkF(Face F,char M) @@ -341,7 +341,7 @@ static bool isMarkedF(Face F,char M) FI=_FaceMark().find(F); if (FI==_FaceMark().end()) return false; - else return ((*FI).second & M); + else return (((*FI).second & M)!=0); } @@ -354,8 +354,8 @@ static bool _LinkConditionsF(PosType pos) _EdgeMark().clear(); // Mark edges of ve0 - vector< TetraType *>::iterator ti=_Sets().v0.begin(); - vector< char >::iterator en=_Sets().indexv0.begin(); + typename vector< TetraType *>::iterator ti=_Sets().v0.begin(); + typename vector< char >::iterator en=_Sets().indexv0.begin(); VertexType *v0=(*ti)->V(*en); while (ti!=_Sets().v0.end()) { @@ -444,8 +444,8 @@ static bool _LinkConditionsE(PosType pos) _FaceMark().clear(); // Mark edges of ve0 - vector< TetraType *>::iterator ti=_Sets().v0.begin(); - vector< char >::iterator en=_Sets().indexv0.begin(); + typename vector< TetraType *>::iterator ti=_Sets().v0.begin(); + typename vector< char >::iterator en=_Sets().indexv0.begin(); while (ti!=_Sets().v0.end()) { //put dummy edge @@ -541,8 +541,8 @@ static bool _QuickConditions(PosType pos) else /// look if the 2 other faces that don't share the vertex are external on not { - vector< TetraType *>::iterator ti=_Sets().E.begin(); - vector< char >::iterator en=_Sets().indexE.begin(); + typename vector< TetraType *>::iterator ti=_Sets().E.begin(); + typename vector< char >::iterator en=_Sets().indexE.begin(); //mark them as intersection while (ti!=_Sets().E.end()) { @@ -586,7 +586,7 @@ static bool _LinkConditionsV() VertexType *vt3; - vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin(); + typename vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin(); //reset all link flags while (ti!=_Sets().v0_U_v1.end()) @@ -598,7 +598,7 @@ static bool _LinkConditionsV() //also in the ones that appartain to the edge - vector< char >::iterator en; + typename vector< char >::iterator en; ti=_Sets().E.begin(); en=_Sets().indexE.begin(); //reset all link flags for intersection and in the same @@ -705,7 +705,7 @@ static bool _FlipCondition(PosType pos,CoordType NewP) CoordType oldpos0; CoordType oldpos1; - vector< TetraType *>::iterator ti=_Sets().no_E.begin(); + typename vector< TetraType *>::iterator ti=_Sets().no_E.begin(); //saving old position oldpos0 = ve0->P(); @@ -765,7 +765,7 @@ static void _InitTetrahedronValues(VertexType* v) { if (VTi.Vt()->V(i)->IsB()) { - if (VertexType::HasNormal) + if (VertexType::HasNormal()) UpdateNormals::PerVertex(VTi.Vt()->V(i)); } @@ -842,7 +842,7 @@ static bool CheckPreconditions(PosType pos,CoordType NewP) ///return the sum of volumes of the union of stars on vertices (the original volume of tetrahedrons) static ScalarType VolumeOriginal() { - vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin(); + typename vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin(); ScalarType vol=0; while (ti!=_Sets().v0_U_v1.end()) { @@ -867,7 +867,7 @@ static ScalarType VolumeSimulateCollapse(PosType Pos,CoordType &newP) //move vertex that remain in the new position Vrem->P() = newP; - vector< TetraType *>::iterator ti=_Sets().no_E.begin(); + typename vector< TetraType *>::iterator ti=_Sets().no_E.begin(); while (ti!=_Sets().no_E.end()) { diff --git a/vcg/complex/tetramesh/update/normal.h b/vcg/complex/tetramesh/update/normal.h index 6d32862a..e0170193 100644 --- a/vcg/complex/tetramesh/update/normal.h +++ b/vcg/complex/tetramesh/update/normal.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.8 2004/10/28 00:54:34 cignoni +Better Doxygen documentation + Revision 1.7 2004/09/01 12:17:25 pietroni minor changes to comply gcc compiler (typename's ) @@ -106,7 +109,6 @@ static void PerVertex(VertexType *v) while (!VTi.End()) { //take the tree faces on the vertex's tetrahedron - int f; for (int j=0;j<3;j++) { int f=Tetra::FofV(VTi.Vi(),j); @@ -118,7 +120,7 @@ static void PerVertex(VertexType *v) } ++VTi; } - Norm/=iter; + Norm/=(float)iter; v->N()=Norm.Normalize(); } diff --git a/vcg/complex/tetramesh/update/topology.h b/vcg/complex/tetramesh/update/topology.h index 40f90444..26656571 100644 --- a/vcg/complex/tetramesh/update/topology.h +++ b/vcg/complex/tetramesh/update/topology.h @@ -455,7 +455,7 @@ static void TestExternalVertex(VertexContainer &vert,TetraContainer &tetra) typedef pair VertBoolPair; map Inserted; - map:: const_iterator MapIte; + typename map::iterator MapIte; for (ti=tetra.begin();ti::iterator TVIo; - std::vector < _triV >::iterator TVIn; + typename std::vector < _triV >::iterator TVIo; + typename std::vector < _triV >::iterator TVIn; TVIo=Faces.begin(); TVIn=Faces.begin(); TVIn++; diff --git a/vcg/complex/tetramesh/update/triconvert.h b/vcg/complex/tetramesh/update/triconvert.h index e71f3076..4324654a 100644 --- a/vcg/complex/tetramesh/update/triconvert.h +++ b/vcg/complex/tetramesh/update/triconvert.h @@ -31,6 +31,7 @@ Initial commit #ifndef __VCG_TETRA_TRI_CONVERTER #define __VCG_TETRA_TRI_CONVERTER #include +#include #include namespace vcg { namespace tetra { @@ -150,7 +151,7 @@ struct InsertedV{ void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim) { vector newVertices; - + typename vector::iterator curr,next; TriVertexIterator vi; vector redirect; @@ -166,7 +167,7 @@ void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim) sort(newVertices.begin(),newVertices.end()); - vector::iterator curr,next; + int pos = 0; curr = next = newVertices.begin(); while( next != newVertices.end()){ @@ -177,7 +178,7 @@ void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim) next++; } - vector::iterator newE = unique(newVertices.begin(),newVertices.end()); + typename vector::iterator newE = unique(newVertices.begin(),newVertices.end()); for(curr = newVertices.begin();curr!= newE;++curr) trim.vert.push_back(*((*curr).v)); diff --git a/vcg/simplex/tetrahedron/base.h b/vcg/simplex/tetrahedron/base.h index 110bd2b4..aa9c580a 100644 --- a/vcg/simplex/tetrahedron/base.h +++ b/vcg/simplex/tetrahedron/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.13 2004/10/04 17:07:58 pietroni +changed Q() function + Revision 1.12 2004/09/01 12:18:39 pietroni minor changes to comply gcc compiler (typename's ) @@ -67,7 +70,7 @@ Revision 1.1 2004/04/15 08:54:20 pietroni #ifndef TETRA_TYPE #pragma message("\nYou should never directly include this file\_n") #else -#define NULL 0 + #include #include @@ -316,7 +319,7 @@ public: { int i; for (i=0;i<4;i++) - if (T(i)==this) + if (TTp(i)==this) { V(Tetra::VofF(i,0))->SetB(); V(Tetra::VofF(i,1))->SetB(); @@ -518,4 +521,4 @@ static bool HasVTAdjacency() { };//end class }//end namespace -#endif \ No newline at end of file +#endif diff --git a/vcg/simplex/tetrahedron/pos.h b/vcg/simplex/tetrahedron/pos.h index f732267b..2c62c092 100644 --- a/vcg/simplex/tetrahedron/pos.h +++ b/vcg/simplex/tetrahedron/pos.h @@ -212,9 +212,9 @@ public: { //take the absolute index of the tree edges of the faces - char e0=vcg::Tetra::EofF(fa,0); - char e1=vcg::Tetra::EofF(fa,1); - char e2=vcg::Tetra::EofF(fa,2); + char e0=vcg::Tetra::EofF(_f ,0); + char e1=vcg::Tetra::EofF(_f ,1); + char e2=vcg::Tetra::EofF(_f ,2); //eliminate the same as himself if (e0==E()) { @@ -369,20 +369,21 @@ private: MTTYPE *_t_initial; short int _back; public : + typedef MTTYPE TetraType; PosJump(const TetraType* tp,const int fap,const int ep, - int vp){T()=tp;F()=fap;E()=ep;V()=vp;_t_initial=tp;_back=0;} + int vp){this->T()=tp;this->F()=fap;this->E()=ep;this->V()=vp;_t_initial=tp;_back=0;} void NextT() { #ifdef _DEBUG int cont=0; #endif - MTTYPE *tpred=T(); + MTTYPE *tpred=this->T(); Pos::NextT(); //external face - if (tpred==T()) + if (tpred==this->T()) { - while (T()!=_t_initial) + while (this->T()!=_t_initial) { Pos::NextT(); #ifdef _DEBUG @@ -408,9 +409,9 @@ private: bool _jump; bool _loop; public : - + typedef MTTYPE TetraType; PosLoop(TetraType* tp,const int fap,const int ep, - int vp){T()=tp;F()=fap;E()=ep;V()=vp;_t_initial=tp;_jump=false;_loop=false;} + int vp){this->T()=tp;this->F()=fap;this->E()=ep;this->V()=vp;_t_initial=tp;_jump=false;_loop=false;} bool LoopEnd() { @@ -431,34 +432,34 @@ PosLoop(TetraType* tp,const int fap,const int ep, void NextT() { #ifdef _DEBUG - TetraType *t_old=T(); + TetraType *t_old=this->T(); #endif - TetraType *tpred=T(); + TetraType *tpred=this->T(); Pos::NextT(); _loop=false; _jump=false; //external face - if (tpred==T()) + if (tpred==this->T()) { - tpred=T(); + tpred=this->T(); //jump next one Pos::NextT(); //find the next external face - while (tpred!=T()) + while (tpred!=this->T()) { - tpred=T(); + tpred=this->T(); Pos::NextT(); } ////reset right rotation sense // Pos::NextT(); _jump=true; } - if (T()==_t_initial) + if (this->T()==_t_initial) _loop=true; #ifdef _DEBUG if (_loop==false) - assert(t_old!=T()); + assert(t_old!=this->T()); #endif } @@ -467,4 +468,4 @@ PosLoop(TetraType* tp,const int fap,const int ep, }//end namespace tetra }//end namespace vcg -#endif \ No newline at end of file +#endif diff --git a/vcg/space/tetra3.h b/vcg/space/tetra3.h index 3b884af1..945d7b5e 100644 --- a/vcg/space/tetra3.h +++ b/vcg/space/tetra3.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.10 2005/11/29 16:20:33 pietroni +added IsInside() function + Revision 1.9 2004/10/13 12:45:51 cignoni Better Doxygen documentation @@ -360,14 +363,14 @@ ScalarType ComputeAspectRatio() double a1=SolidAngle(1); double a2=SolidAngle(2); double a3=SolidAngle(3); - return (min(a0,min(a1,min(a2,a3)))); + return (ScalarType)math::Min(a0,math::Min(a1,math::Min(a2,a3))); } ///return true of p is inside tetrahedron's volume bool IsInside(const CoordType &p) { //bb control - vcg::Box3 bb; + vcg::Box3 bb; for (int i=0;i<4;i++) bb.Add(_v[i]); @@ -440,7 +443,7 @@ ScalarType ComputeAspectRatio() // compute and return the volume of a tetrahedron template typename TetraType::ScalarType ComputeVolume( const TetraType & t){ - return (( t.cP(2)-t.cP(0))^(t.cP(1)-t.cP(0) ))*(t.cP(3)-t.cP(0))/6.0; + return (typename TetraType::ScalarType)((( t.cP(2)-t.cP(0))^(t.cP(1)-t.cP(0) ))*(t.cP(3)-t.cP(0))/6.0); } /// Returns the normal to the face face of the tetrahedron t