Conformed C++ syntax to GCC requirements

This commit is contained in:
Paolo Cignoni 2004-05-12 12:23:23 +00:00
parent e826bde7c3
commit ed904aa9ac
3 changed files with 36 additions and 25 deletions

View File

@ -45,7 +45,7 @@ using namespace std;
// Vertex, Face, Mesh and Grid definitions. // Vertex, Face, Mesh and Grid definitions.
class MyEdge; class MyEdge;
class CFace; class CFace;
class CVertex : public VertexCMNQ< double,MyEdge,CFace > {}; class CVertex : public VertexVCVMVNVQ< double,MyEdge,CFace > {};
class CFace : public FaceRTFMFN< CVertex,MyEdge,CFace > {}; class CFace : public FaceRTFMFN< CVertex,MyEdge,CFace > {};
class CMesh : public tri::TriMesh< vector<CVertex>, vector<CFace> > {}; class CMesh : public tri::TriMesh< vector<CVertex>, vector<CFace> > {};

View File

@ -70,6 +70,15 @@ private:
typedef GridStaticPtr< typename MetroMesh::FaceContainer > MetroMeshGrid; typedef GridStaticPtr< typename MetroMesh::FaceContainer > MetroMeshGrid;
typedef Point3<typename MetroMesh::ScalarType> Point3x; typedef Point3<typename MetroMesh::ScalarType> Point3x;
typedef typename MetroMesh::CoordType CoordType;
typedef typename MetroMesh::ScalarType ScalarType;
typedef typename MetroMesh::VertexPointer VertexPointer;
typedef typename MetroMesh::VertexIterator VertexIterator;
typedef typename MetroMesh::FaceIterator FaceIterator;
typedef typename MetroMesh::FaceType FaceType;
// data structures // data structures
MetroMesh &S1; MetroMesh &S1;
MetroMesh &S2; MetroMesh &S2;
@ -100,7 +109,7 @@ private:
// private methods // private methods
inline double ComputeMeshArea(MetroMesh & mesh); inline double ComputeMeshArea(MetroMesh & mesh);
float AddSample(const Point3x &p); float AddSample(const Point3x &p);
inline void AddRandomSample(typename MetroMesh::FaceIterator &T); inline void AddRandomSample(FaceIterator &T);
inline void SampleEdge(const Point3x & v0, const Point3x & v1, int n_samples_per_edge); inline void SampleEdge(const Point3x & v0, const Point3x & v1, int n_samples_per_edge);
void VertexSampling(); void VertexSampling();
void EdgeSampling(); void EdgeSampling();
@ -164,7 +173,7 @@ void Sampling<MetroMesh>::SetSamplesPerAreaUnit(double _n_samp)
template <class MetroMesh> template <class MetroMesh>
inline double Sampling<MetroMesh>::ComputeMeshArea(MetroMesh & mesh) inline double Sampling<MetroMesh>::ComputeMeshArea(MetroMesh & mesh)
{ {
typename MetroMesh::FaceIterator face; FaceIterator face;
double area = 0.0; double area = 0.0;
for(face=mesh.face.begin(); face != mesh.face.end(); face++) for(face=mesh.face.begin(); face != mesh.face.end(); face++)
@ -177,9 +186,9 @@ inline double Sampling<MetroMesh>::ComputeMeshArea(MetroMesh & mesh)
template <class MetroMesh> template <class MetroMesh>
float Sampling<MetroMesh>::AddSample(const Point3x &p) float Sampling<MetroMesh>::AddSample(const Point3x &p)
{ {
typename MetroMesh::FaceType *f=0; FaceType *f=0;
Point3x normf, bestq, ip; Point3x normf, bestq, ip;
typename MetroMesh::ScalarType dist; ScalarType dist;
dist = dist_upper_bound; dist = dist_upper_bound;
@ -214,7 +223,7 @@ void Sampling<MetroMesh>::VertexSampling()
float error; float error;
printf("Vertex sampling\n"); printf("Vertex sampling\n");
typename MetroMesh::VertexIterator vi; VertexIterator vi;
for(vi=S1.vert.begin();vi!=S1.vert.end();++vi) for(vi=S1.vert.begin();vi!=S1.vert.end();++vi)
{ {
error = AddSample((*vi).cP()); error = AddSample((*vi).cP());
@ -269,13 +278,13 @@ template <class MetroMesh>
void Sampling<MetroMesh>::EdgeSampling() void Sampling<MetroMesh>::EdgeSampling()
{ {
// Edge sampling. // Edge sampling.
typedef std::pair<typename MetroMesh::VertexPointer, typename MetroMesh::VertexPointer> pvv; typedef std::pair<VertexPointer, VertexPointer> pvv;
std::vector< pvv > Edges; std::vector< pvv > Edges;
printf("Edge sampling\n"); printf("Edge sampling\n");
// compute edge list. // compute edge list.
typename MetroMesh::FaceIterator fi; FaceIterator fi;
for(fi=S1.face.begin(); fi != S1.face.end(); fi++) for(fi=S1.face.begin(); fi != S1.face.end(); fi++)
for(int i=0; i<3; ++i) for(int i=0; i<3; ++i)
{ {
@ -288,7 +297,7 @@ void Sampling<MetroMesh>::EdgeSampling()
Edges.resize(edgeend-Edges.begin()); Edges.resize(edgeend-Edges.begin());
// sample edges. // sample edges.
std::vector<pvv>::iterator ei; typename std::vector<pvv>::iterator ei;
double n_samples_per_length_unit; double n_samples_per_length_unit;
double n_samples_decimal = 0.0; double n_samples_decimal = 0.0;
int cnt=0; int cnt=0;
@ -316,7 +325,7 @@ void Sampling<MetroMesh>::EdgeSampling()
// Montecarlo sampling. // Montecarlo sampling.
template <class MetroMesh> template <class MetroMesh>
inline void Sampling<MetroMesh>::AddRandomSample(typename MetroMesh::FaceIterator &T) inline void Sampling<MetroMesh>::AddRandomSample(FaceIterator &T)
{ {
// random sampling over the input face. // random sampling over the input face.
double rnd_1, rnd_2; double rnd_1, rnd_2;
@ -349,7 +358,7 @@ void Sampling<MetroMesh>::MontecarloFaceSampling()
// Montecarlo sampling. // Montecarlo sampling.
int cnt = 0; int cnt = 0;
double n_samples_decimal = 0.0; double n_samples_decimal = 0.0;
typename MetroMesh::FaceIterator fi; FaceIterator fi;
srand(clock()); srand(clock());
// printf("Montecarlo face sampling\n"); // printf("Montecarlo face sampling\n");
@ -474,7 +483,7 @@ void Sampling<MetroMesh>::SimilarFaceSampling()
// Similar Triangles sampling. // Similar Triangles sampling.
int cnt = 0, n_samples_per_edge; int cnt = 0, n_samples_per_edge;
double n_samples_decimal = 0.0; double n_samples_decimal = 0.0;
typename MetroMesh::FaceIterator fi; FaceIterator fi;
printf("Similar Triangles face sampling\n"); printf("Similar Triangles face sampling\n");
for(fi=S1.face.begin(); fi != S1.face.end(); fi++) for(fi=S1.face.begin(); fi != S1.face.end(); fi++)
@ -505,7 +514,7 @@ void Sampling<MetroMesh>::SimilarFaceSampling()
template <class MetroMesh> template <class MetroMesh>
void Sampling<MetroMesh>::Hausdorff() void Sampling<MetroMesh>::Hausdorff()
{ {
Box3< typename MetroMesh::ScalarType> bbox; Box3< ScalarType> bbox;
// set grid meshes. // set grid meshes.
gS2.SetBBox(S2.bbox); gS2.SetBBox(S2.bbox);
@ -551,7 +560,7 @@ void Sampling<MetroMesh>::Hausdorff()
// compute vertex colour // compute vertex colour
if(Flags & FLAG_SAVE_ERROR_AS_COLOUR) if(Flags & FLAG_SAVE_ERROR_AS_COLOUR)
{ {
typename MetroMesh::VertexIterator vi; VertexIterator vi;
float error; float error;
int cnt = 0; int cnt = 0;
for(vi=S1.vert.begin();vi!=S1.vert.end();++vi) for(vi=S1.vert.begin();vi!=S1.vert.end();++vi)

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.6 2004/05/11 16:03:18 ganovelli
changed from "thi" to "&f" in Vfdetach
Revision 1.5 2004/05/10 15:20:49 cignoni Revision 1.5 2004/05/10 15:20:49 cignoni
Updated names of POS and adj functions to the new standards for many functions Updated names of POS and adj functions to the new standards for many functions
@ -215,28 +218,27 @@ void Swap (SwapFaceType &f, const int z )
template <class FaceType> template <class FaceType>
void VFDetach(FaceType & f, int z) void VFDetach(FaceType & f, int z)
{ {
if(f.V(z)->Fp()==&f ) if(f.V(z)->VFp()==&f ) //if it is the first face detach from the begin
{ {
int fz = f.V(z)->Zp(); int fz = f.V(z)->VFb();
f.V(z)->Fp() = (face_from_vert_type *) f.F(fz); f.V(z)->VFb() = f.VFp(fz);
f.V(z)->Zp() = f.Z(fz); f.V(z)->VFi() = f.VFi(fz);
} }
else else // scan the list of faces in order to finde the current face f to be detached
{ {
VEdgePosB<FACE_TYPE> x,y; VEdgePosB<FACE_TYPE> x,y;
Pos< FaceType > x(V(z)->VFb(),V(z)->VFi());
x.f = V(z)->Fp(); Pos< FaceType > y;
x.z = V(z)->Zp();
for(;;) for(;;)
{ {
y = x; y = x;
x.NextF(); x.NextF();
assert(x.f!=0); assert(x.f!=0);
if(x.f==&f) if(x.f==&f) // found!
{ {
y.f->F(y.z) = f.F(z); y.f->FFp(y.z) = f.FFp(z);
y.f->Z(y.z) = f.Z(z); y.f->FFi(y.z) = f.FFi(z);
break; break;
} }
} }