minor changes to comply gcc compiler (typename's )

This commit is contained in:
Nico Pietroni 2004-09-01 12:22:04 +00:00
parent c3227ae7a0
commit cf20e1d0c1
9 changed files with 128 additions and 107 deletions

View File

@ -31,12 +31,12 @@
#include<vcg\complex\local_optimization.h>
struct FAIL{
static VOL(){static int vol=0; return vol++;}
static LKF(){static int lkf=0; return lkf++;}
static LKE(){static int lke=0; return lke++;}
static LKV(){static int lkv=0; return lkv++;}
static OFD(){static int ofd=0; return ofd++;}
static BOR(){static int bor=0; return bor++;}
static int VOL(){static int vol=0; return vol++;}
static int LKF(){static int lkf=0; return lkf++;}
static int LKE(){static int lke=0; return lke++;}
static int LKV(){static int lkv=0; return lkv++;}
static int OFD(){static int ofd=0; return ofd++;}
static int BOR(){static int bor=0; return bor++;}
};
@ -55,15 +55,15 @@ class TetraEdgeCollapse: public LocalOptimization<TETRA_MESH_TYPE>::LocModType
{
/// The tetrahedral mesh type
typedef typename TETRA_MESH_TYPE TetraMeshType;
//typedef typename TETRA_MESH_TYPE TETRA_MESH_TYPE;
/// The tetrahedron type
typedef typename TetraMeshType::TetraType TetraType;
typedef typename TETRA_MESH_TYPE::TetraType TetraType;
/// The vertex type
typedef typename TetraType::VertexType VertexType;
/// The coordinate type
typedef typename TetraType::VertexType::CoordType CoordType;
/// The scalar type
typedef typename TetraMeshType::VertexType::ScalarType ScalarType;
typedef typename TETRA_MESH_TYPE::VertexType::ScalarType ScalarType;
/////the base type class
//typedef typename vcg::tri::LocalModification LocalMod;
/// The HEdgePos type
@ -77,7 +77,7 @@ private:
///the new point that substitute the edge
Point3<ScalarType> _NewPoint;
///the pointer to edge collapser method
vcg::tetra::EdgeCollapse<TetraMeshType> _EC;
vcg::tetra::EdgeCollapse<TETRA_MESH_TYPE> _EC;
///mark for up_dating
static int& _Imark(){ static int im=0; return im;}
///the pos of collapse
@ -129,7 +129,6 @@ ScalarType _VolumePreservingError(PosType &pos,CoordType &new_point,int nsteps)
{
VertexType *ve0=(pos.T()->V(Tetra::VofE(pos.E(),0)));
VertexType *ve1=(pos.T()->V(Tetra::VofE(pos.E(),1)));
vrem =ve0;
bool ext_v0=ve0->IsB();
bool ext_v1=ve1->IsB();
@ -168,10 +167,9 @@ ScalarType _VolumePreservingError(PosType &pos,CoordType &new_point,int nsteps)
public:
virtual const char *Info(TetraMeshType &m) {
virtual const char *Info(TETRA_MESH_TYPE &m) {
static char buf[60];
sprintf(buf,"collapse %i -> %i %f\n", pos.V()-&m.vert[0], pos.VFlip()-&m.vert[0],_priority);
//sprintf(buf,"collapse %i -> %i %f\n", pos.()-&m.vert[0], pos.VFlip()-&m.vert[0],_priority);
return buf;
}
@ -182,43 +180,49 @@ public:
ScalarType ComputeError()
{
_EC.FindSets(pos);
vrem=(pos.T()->V(Tetra::VofE(pos.E(),0)));
return (_VolumePreservingError(pos,_NewPoint,5));// magic number....parametrize!
}
int Execute()
void Execute(TETRA_MESH_TYPE &tm)
{
_EC.FindSets(pos);
return -_EC.DoCollapse(pos,_NewPoint);
// _EC.FindSets(pos);
assert(!vrem->IsD());
int del=_EC.DoCollapse(pos,_NewPoint);
tm.tn-=del;
tm.vn-=1;
}
void UpdateHeap(typename LocalOptimization<TetraMeshType>::HeapType & h_ret)
void UpdateHeap(typename LocalOptimization<TETRA_MESH_TYPE>::HeapType & h_ret)
{
assert(!vrem->IsD());
_Imark()++;
VTIterator<FaceType> VTi(vrem->VTb(),vrem->VTi());
VTIterator<TetraType> VTi(vrem->VTb(),vrem->VTi());
while (!VTi.End())
{
VTi.Vt()->ComputeVolume();
for (int j=0;j<6;j++)
{
vcg::tri::Pos<FaceType> p=Pos<FaceType>(VTi.Vt(),Tetra::FofE(j,0),j,Tetra::VofE(j,0));
h_ret.push_back(HeapElem(new TriEdgeCollapser<TriMeshType>(p,_Imark())));
vcg::tetra::Pos<TetraType> p=Pos<TetraType>(VTi.Vt(),Tetra::FofE(j,0),j,Tetra::VofE(j,0));
assert(!p.T()->V(p.V())->IsD());
assert(!p.T()->IsD());
h_ret.push_back(HeapElem(new TetraEdgeCollapse<TETRA_MESH_TYPE>(p,_Imark())));
std::push_heap(h_ret.begin(),h_ret.end());
// update the mark of the vertices
VTi.Vt()->V(Tetra::VofE(j,0))->IMark() = _Imark();
}
VTi++;
++VTi;
}
}
ModifierType IsOfType(){ return TetraEdgeCollapser;}
/// return the type of operation
ModifierType IsOfType(){ return TetraEdgeCollapseOp;}
bool IsFeasible(){
vcg::tri::EdgeCollapse<TriMeshType>::Reset();
vcg::tetra::EdgeCollapse<TETRA_MESH_TYPE>::Reset();
_EC.FindSets(pos);
ComputeError();
return(_EC.CheckPreconditions(pos,_NewPoint));
}
@ -227,7 +231,8 @@ public:
{
VertexType *v0=pos.T()->V(Tetra::VofE(pos.E(),0));
VertexType *v1=pos.T()->V(Tetra::VofE(pos.E(),1));
assert(!v0->IsD());
assert(!v1->IsD());
if(! (( (!v0->IsD()) && (!v1->IsD())) &&
_Imark()>=v0->IMark() &&
_Imark()>=v1->IMark()))
@ -242,13 +247,14 @@ public:
return false;
}
virtual ScalarType Priority(){
virtual ScalarType Priority() const {
return _priority;
}
virtual void Init(TetraMeshType &m,typename LocalOptimization<TetraMeshType>::HeapType& h_ret){
/// perform initialization
static void Init(TETRA_MESH_TYPE &m,typename LocalOptimization<TETRA_MESH_TYPE>::HeapType& h_ret){
h_ret.clear();
TetraMeshType::TetraIterator ti;
typename TETRA_MESH_TYPE::TetraIterator ti;
int j;
for(ti = m.tetra.begin(); ti != m.tetra.end();++ti)
if(!(*ti).IsD()){
@ -256,7 +262,9 @@ public:
for (int j=0;j<6;j++)
{
PosType p=PosType(&*ti,Tetra::FofE(j,0),j,Tetra::VofE(j,0));
h_ret.push_back(HeapElem(new TriEdgeCollapser<TetraMeshType>(p,m.IMark)));
assert(!p.T()->V(p.V())->IsD());
assert(!p.T()->IsD());
h_ret.push_back(HeapElem(new TetraEdgeCollapse<TETRA_MESH_TYPE>(p,m.IMark)));
}
}
}

View File

@ -44,7 +44,7 @@ class EdgeCollapse
{
public:
/// The tetrahedral mesh type
typedef typename TETRA_MESH_TYPE TetraMeshType;
typedef TETRA_MESH_TYPE TetraMeshType;
/// The tetrahedron type
typedef typename TetraMeshType::TetraType TetraType;
/// The vertex type
@ -66,9 +66,9 @@ class EdgeCollapse
/// The HEdgePos Loop type
typedef PosLoop<TetraType> PosLType;
/// The topology updater type
typedef vcg::tetra::UpdateTetraTopology<VertexContainer,TetraContainer> Topology;
typedef typename vcg::tetra::UpdateTetraTopology<VertexContainer,TetraContainer> Topology;
///the normal updater type
typedef vcg::tetra::UpdateNormals<TetraMeshType> UpdateNormals;
typedef typename vcg::tetra::UpdateNormals<TetraMeshType> UpdateNormals;
/// Default Constructor
@ -81,6 +81,7 @@ class EdgeCollapse
};
private:
typedef pair <int,int> FacePair;
struct Face
{
@ -307,7 +308,7 @@ static int _Collapse(PosType p,CoordType NewP)
static void orMarkE(Edge E,char M)
{
map<Edge,char>::iterator EI;
typename map<Edge,char>::iterator EI;
EI=_EdgeMark().find(E);
if (EI==_EdgeMark().end())
_EdgeMark().insert (pair<Edge,char>(E,M));
@ -317,7 +318,7 @@ static void orMarkE(Edge E,char M)
static bool isMarkedE(Edge E,char M)
{
map<Edge,char>::iterator EI;
typename map<Edge,char>::iterator EI;
EI=_EdgeMark().find(E);
if (EI==_EdgeMark().end())
return false;
@ -326,7 +327,7 @@ static bool isMarkedE(Edge E,char M)
static void orMarkF(Face F,char M)
{
map<Face,char>::iterator FI;
typename map< Face,char>::iterator FI;
FI=_FaceMark().find(F);
if (FI==_FaceMark().end())
_FaceMark().insert (pair<Face,char>(F,M));
@ -336,7 +337,7 @@ static void orMarkF(Face F,char M)
static bool isMarkedF(Face F,char M)
{
map<Face,char>::iterator FI;
typename map<Face,char>::iterator FI;
FI=_FaceMark().find(F);
if (FI==_FaceMark().end())
return false;
@ -753,7 +754,7 @@ static void _InitTetrahedronValues(VertexType* v)
VTi.Vt()->ComputeNormal();
}
VTi++;
++VTi;
}
VTi.Vt()=v->VTb();
@ -787,7 +788,8 @@ static void Reset(){
///that share the adge to collapse
static ScalarType AspectRatioCollapsed(PosType p)
{
PosL pos=PosL(p.T(),p.F(),p.E(),p.V());
//PosL pos=PosL(p.T(),p.F(),p.E(),p.V());
PosLoop<TetraType> pos=PosLoop<TetraType>(p.T(),p.F(),p.E(),p.V());
pos.Reset();
int num=0;
ScalarType ratio_media=0.f;
@ -851,7 +853,7 @@ static ScalarType VolumeOriginal()
}
///Calculate the volume on the vertex resulting after collapse...
static ScalarType VolumeSimulateCollapse(PosType Pos,CoordType newP)
static ScalarType VolumeSimulateCollapse(PosType Pos,CoordType &newP)
{
VertexType *Vrem=(Pos.T()->V(Tetra::VofE(Pos.E(),0)));
VertexType *Vdel=(Pos.T()->V(Tetra::VofE(Pos.E(),1)));
@ -917,7 +919,7 @@ static void FindSets(vcg::tetra::Pos<TetraType> pos)
//set of union minus intersection
if ((vf0.Vt()->V(0)!=ve1)&&(vf0.Vt()->V(1)!=ve1)&&(vf0.Vt()->V(2)!=ve1)&&(vf0.Vt()->V(3)!=ve1))
_Sets().no_E.push_back(vf0.Vt());
vf0++;
++vf0;
}
//second vertex iteration
@ -934,7 +936,7 @@ static void FindSets(vcg::tetra::Pos<TetraType> pos)
//set of union minus intersection
if ((vf0.Vt()->V(0)!=ve0)&&(vf0.Vt()->V(1)!=ve0)&&(vf0.Vt()->V(2)!=ve0)&&(vf0.Vt()->V(3)!=ve0))
_Sets().no_E.push_back(vf0.Vt());
vf0++;
++vf0;
}
//erase duplicated tetrahedrons from the union set
@ -959,9 +961,9 @@ static int DoCollapse(PosType p,CoordType newP)
{
VertexType *v=p.T()->V(p.V());
assert(p.T()->HasVTAdjacency());
int n_deleted = _Collapse(p,newP);
int n_del=_Collapse(p,newP);
_InitTetrahedronValues(v);
return n_deleted;
return n_del;
}

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.6 2004/06/25 11:25:07 pietroni
changrd update for a vertex normal functions void PerVertex(VertexType *v)
Revision 1.5 2004/06/15 16:01:26 pietroni
added functions to update local vertices normal
@ -74,6 +77,7 @@ typedef typename TetraMeshType::VertexIterator VertexIterator;
typedef typename TetraMeshType::TetraType TetraType;
typedef typename TetraMeshType::TetraPointer TetraPointer;
typedef typename TetraMeshType::TetraIterator TetraIterator;
typedef typename VertexType::NormalType NormalType;
typedef vcg::Face<VertexType,vcg::DUMMYEDGETYPE,vcg::DUMMYFACETYPE> FaceTemp;
typedef vcg::tri::TriMesh< std::vector<VertexType>,std::vector<FaceTemp> > TriMeshTemp;
@ -94,7 +98,7 @@ static void PerVertex(VertexType *v)
if( !VertexType::HasNormal()) return;
VTIterator<TetraType> VTi=VTIterator<TetraType>(v->VTb(),v->VTi());
VertexType::NormalType Norm=VertexType::NormalType(0,0,0);
NormalType Norm=NormalType(0,0,0);
int iter=0;
while (!VTi.End())
{
@ -109,7 +113,7 @@ static void PerVertex(VertexType *v)
Norm+=VTi.Vt()->N(f);
}
}
VTi++;
++VTi;
}
Norm/=iter;
v->N()=Norm.Normalize();

View File

@ -259,7 +259,7 @@ static void DetachVTTopology(VertexType *v,TetraType *t)
{
lastz=Et.Vi();
lastt=Et.Vt();
Et++;
++Et;
}
//in the list of the vertex v must be present the
//tetrahedron that you want to detach
@ -339,27 +339,27 @@ static void TTTopology(VertexContainer &vert,TetraContainer &tetra)
(*ti).TTp(2)=(&(*ti));
(*ti).TTp(3)=(&(*ti));
v0=(*ti).V(Tetra3<double>::VofF(0,0));
v1=(*ti).V(Tetra3<double>::VofF(0,1));
v2=(*ti).V(Tetra3<double>::VofF(0,2));
v0=(*ti).V(Tetra::VofF(0,0));
v1=(*ti).V(Tetra::VofF(0,1));
v2=(*ti).V(Tetra::VofF(0,2));
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),0));
v0=(*ti).V(Tetra3<double>::VofF(1,0));
v1=(*ti).V(Tetra3<double>::VofF(1,1));
v2=(*ti).V(Tetra3<double>::VofF(1,2));
v0=(*ti).V(Tetra::VofF(1,0));
v1=(*ti).V(Tetra::VofF(1,1));
v2=(*ti).V(Tetra::VofF(1,2));
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),1));
v0=(*ti).V(Tetra3<double>::VofF(2,0));
v1=(*ti).V(Tetra3<double>::VofF(2,1));
v2=(*ti).V(Tetra3<double>::VofF(2,2));
v0=(*ti).V(Tetra::VofF(2,0));
v1=(*ti).V(Tetra::VofF(2,1));
v2=(*ti).V(Tetra::VofF(2,2));
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),2));
v0=(*ti).V(Tetra3<double>::VofF(3,0));
v1=(*ti).V(Tetra3<double>::VofF(3,1));
v2=(*ti).V(Tetra3<double>::VofF(3,2));
v0=(*ti).V(Tetra::VofF(3,0));
v1=(*ti).V(Tetra::VofF(3,1));
v2=(*ti).V(Tetra::VofF(3,2));
VF.push_back(Facet<VertexType,TetraType>(v0,v1,v2,&(*ti),3));
}
@ -415,17 +415,17 @@ static void TestTTTopology(VertexContainer &vert,TetraContainer &tetra)
{
assert( ((((*ti).TTp(i))->TTp((*ti).TTi(i)))==&(*ti)));
VertexType *v0=(*ti).V(Tetra3<double>::VofF(i,0));
VertexType *v1=(*ti).V(Tetra3<double>::VofF(i,1));
VertexType *v2=(*ti).V(Tetra3<double>::VofF(i,2));
VertexType *v0=(*ti).V(Tetra::VofF(i,0));
VertexType *v1=(*ti).V(Tetra::VofF(i,1));
VertexType *v2=(*ti).V(Tetra::VofF(i,2));
TetraType *t1=(TetraType*)(*ti).TTp(i);
assert (!t1->IsD());
int z1=(*ti).TTi(i);
VertexType *vo0=(*t1).V(Tetra3<double>::VofF(z1,0));
VertexType *vo1=(*t1).V(Tetra3<double>::VofF(z1,1));
VertexType *vo2=(*t1).V(Tetra3<double>::VofF(z1,2));
VertexType *vo0=(*t1).V(Tetra::VofF(z1,0));
VertexType *vo1=(*t1).V(Tetra::VofF(z1,1));
VertexType *vo2=(*t1).V(Tetra::VofF(z1,2));
assert((v0!=v1)&&(v0!=v2)&&(v1!=v2));
assert((vo0!=vo1)&&(vo0!=vo2)&&(vo1!=vo2));

View File

@ -48,9 +48,9 @@ class TriConverter
public:
/// The tetrahedral mesh type
typedef typename TETRA_MESH TetraMeshType;
typedef TETRA_MESH TetraMeshType;
/// The triangle mesh type
typedef typename TRI_MESH TriangleMeshType;
typedef TRI_MESH TriangleMeshType;
/// The tetrahedron type
typedef typename TetraMeshType::TetraType TetraType;

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.11 2004/08/26 13:15:23 pietroni
added IsS() function
Revision 1.10 2004/07/09 10:13:00 ganovelli
C() ,Q() ,hastetracolor(),hasqualityt()....
plus some misuse of tetra3 corrected
@ -82,7 +85,7 @@ public:
/// The base type of the face
typedef TETRA_TYPE BaseTetraType;
/// The vertex type
typedef typename VTYPE VertexType;
typedef VTYPE VertexType;
/// The coordinate type used to represent the point (i.e. Point3f, Point3d, ...)
typedef typename VertexType::CoordType CoordType;
/// The scalar type used to represent coords (i.e. float, double, ...)

View File

@ -46,7 +46,7 @@ class VTIterator
{
public:
/// The tetrahedron type
typedef typename MTTYPE TetraType;
typedef MTTYPE TetraType;
private:
/// Pointer to a tetrahedron
TetraType *_vt;
@ -110,7 +110,7 @@ class Pos
public:
/// The tetrahedron type
typedef typename MTTYPE TetraType;
typedef MTTYPE TetraType;
/// The vertex type
typedef typename TetraType::VertexType VertexType;
/// The coordinate type

View File

@ -24,6 +24,10 @@
History
$Log: not supported by cvs2svn $
Revision 1.7 2004/07/09 10:08:21 ganovelli
ComputeVOlume moved outside the class and other
minor corrections
Revision 1.6 2004/06/25 18:17:03 ganovelli
minor changes
@ -279,7 +283,7 @@ static int FofEE(const int &indexE0,const int &indexE1)
{
public:
typedef Point3< ScalarType > CoordType;
typedef ScalarType ScalarType;
//typedef typename ScalarType ScalarType;
/*********************************************

View File

@ -9,7 +9,7 @@ namespace io {
template <typename MESHTYPE>
class ImporterTS{
typedef typename MESHTYPE Tetramesh;
typedef MESHTYPE Tetramesh;
typedef typename Tetramesh::VertexPointer VertexPointer;
typedef typename Tetramesh::VertexType VertexType;
typedef typename Tetramesh::TetraType FaceType;
@ -31,7 +31,7 @@ static int Open( Tetramesh & m, const char * filename ) {
int tp3;
float mass;
FILE *f;
Tetramesh::VertexType p1;
typename Tetramesh::VertexType p1;
f = fopen(filename,"r");
if(f == NULL )
{
@ -62,7 +62,7 @@ static int Open( Tetramesh & m, const char * filename ) {
fscanf(f, "%i", &tp2 );
fscanf(f, "%i", &tp3 );
Tetramesh::TetraType newTetra;
typename Tetramesh::TetraType newTetra;
m.tetra.push_back(newTetra);
m.tetra.back().Init(&m.vert[tp0],&m.vert[tp1],&m.vert[tp2],&m.vert[tp3]);
}