modifications to compile with gcc

This commit is contained in:
ganovelli 2005-12-12 11:15:26 +00:00
parent 0fc829e2b8
commit f73fa19346
9 changed files with 71 additions and 55 deletions

View File

@ -27,7 +27,11 @@
#ifndef __VCG_DECIMATION_COLLAPSE
#define __VCG_DECIMATION_COLLAPSE
#include<vcg\complex\local_optimization.h>
#include<vcg/complex/local_optimization.h>
#include<vcg/simplex/tetrahedron/pos.h>
#include<vcg/complex/tetramesh/edge_collapse.h>
#include<vcg/space/point3.h>
struct FAIL{
static int VOL(){static int vol=0; return vol++;}
@ -74,7 +78,7 @@ class TetraEdgeCollapse: public LocalOptimization<TETRA_MESH_TYPE>::LocModType
private:
///the new point that substitute the edge
Point<3,ScalarType> _NewPoint;
Point3<ScalarType> _NewPoint;
///the pointer to edge collapser method
vcg::tetra::EdgeCollapse<TETRA_MESH_TYPE> _EC;
///mark for up_dating
@ -154,7 +158,7 @@ ScalarType _VolumePreservingError(PosType &pos,CoordType &new_point,int nsteps)
for (int i=0;i<nsteps;i++)
{
best_error=1000000.f;
ScalarType alfatemp=step*((double)i);
ScalarType alfatemp=step*((ScalarType)i);
//CoordType g;
// g.Zero();
//g+=ve0->cP()*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<TETRA_MESH_TYPE>::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();

View File

@ -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(){

View File

@ -271,7 +271,7 @@ static int _Collapse(PosType p,CoordType NewP)
}
//delting old tetrahedrons
vector<TetraType*>::iterator ti;
typename vector<TetraType*>::iterator ti;
for (ti=To_Del.begin();ti<To_Del.end();ti++)
(*ti)->SetD();
@ -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())
{

View File

@ -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();
}

View File

@ -455,7 +455,7 @@ static void TestExternalVertex(VertexContainer &vert,TetraContainer &tetra)
typedef pair <VertexType*, bool> VertBoolPair;
map<VertexType*, bool> Inserted;
map<VertexType*, bool>:: const_iterator MapIte;
typename map<VertexType*, bool>::iterator MapIte;
for (ti=tetra.begin();ti<tetra.end();ti++)
{
@ -657,8 +657,8 @@ static bool IsExternEdge(TetraType *t,int edge)
//now look if one face is no shared from other tetrahedron
//2 instances of same face in vector means it is internal face
bool isExtern=false;
std::vector < _triV >::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++;

View File

@ -31,6 +31,7 @@ Initial commit
#ifndef __VCG_TETRA_TRI_CONVERTER
#define __VCG_TETRA_TRI_CONVERTER
#include <map>
#include <vector>
#include<vcg/space/tetra3.h>
namespace vcg {
namespace tetra {
@ -150,7 +151,7 @@ struct InsertedV{
void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim)
{
vector<InsertedV > newVertices;
typename vector<InsertedV>::iterator curr,next;
TriVertexIterator vi;
vector<TriVertexType*> redirect;
@ -166,7 +167,7 @@ void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim)
sort(newVertices.begin(),newVertices.end());
vector<InsertedV>::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<InsertedV>::iterator newE = unique(newVertices.begin(),newVertices.end());
typename vector<InsertedV>::iterator newE = unique(newVertices.begin(),newVertices.end());
for(curr = newVertices.begin();curr!= newE;++curr)
trim.vert.push_back(*((*curr).v));

View File

@ -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<vcg/space/point3.h>
#include<vcg/space/tetra3.h>
@ -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
#endif

View File

@ -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<MTTYPE>::NextT();
//external face
if (tpred==T())
if (tpred==this->T())
{
while (T()!=_t_initial)
while (this->T()!=_t_initial)
{
Pos<MTTYPE>::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<TetraType>::NextT();
_loop=false;
_jump=false;
//external face
if (tpred==T())
if (tpred==this->T())
{
tpred=T();
tpred=this->T();
//jump next one
Pos<TetraType>::NextT();
//find the next external face
while (tpred!=T())
while (tpred!=this->T())
{
tpred=T();
tpred=this->T();
Pos<TetraType>::NextT();
}
////reset right rotation sense
// Pos<TetraType>::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
#endif

View File

@ -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<CoordType::ScalarType> bb;
vcg::Box3<typename CoordType::ScalarType> 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<class TetraType>
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