Necessary changes for compilation with gcc 3.4.6. Especially the hash function is a problem

This commit is contained in:
Paolo Cignoni 2006-11-07 15:13:57 +00:00
parent 06047a697d
commit e2733d55df
6 changed files with 44 additions and 10 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.13 2006/11/07 11:47:11 cignoni
gcc compiling issues
Revision 1.12 2006/11/07 07:56:43 cignoni
Added missing std::
@ -150,7 +153,7 @@ namespace vcg {
void Refresh(MESH &m)
{
p.f = (MESH::FacePointer)(faceindex + &(*(m.face.begin())));
p.f = (typename MESH::FacePointer)(faceindex + &(*(m.face.begin())));
}
bool operator < (const HoleInfo & hh) const {return size < hh.size;}
@ -1136,6 +1139,9 @@ namespace vcg {
{
public:
using TrivialEar<MSH_TYPE>::e0;
using TrivialEar<MSH_TYPE>::e1;
using TrivialEar<MSH_TYPE>::quality;
TrivialEarN(){}
TrivialEarN(const face::Pos<typename MSH_TYPE::FaceType> & ep)
{

View File

@ -23,6 +23,9 @@
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.12 2006/11/07 11:28:02 cignoni
Added Quality weighted laplacian smoothing
Revision 1.11 2006/10/19 07:33:03 cignoni
Corrected Laplacian, Added selection to HCSmooth
@ -677,7 +680,7 @@ void NormalSmooth(MESH_TYPE &m,
for(fi=m.face.begin();fi!=m.face.end();++fi)
{
CoordType bc=Barycenter<MESH_TYPE::FaceType>(*fi);
CoordType bc=Barycenter<typename MESH_TYPE::FaceType>(*fi);
// 1) Clear all the selected flag of faces that are vertex-adjacent to fi
for(i=0;i<3;++i)
{
@ -824,7 +827,7 @@ void FastFitMesh(MESH_TYPE &m,
VFLocalIterator ep(&*vi);
for (;!ep.End();++ep)
{
CoordType bc=Barycenter<MESH_TYPE::FaceType>(*ep.F());
CoordType bc=Barycenter<typename MESH_TYPE::FaceType>(*ep.F());
Sum += ep.F()->N()*(ep.F()->N()*(bc - (*vi).P()));
++cnt;
}

View File

@ -24,6 +24,10 @@
History
$Log: not supported by cvs2svn $
Revision 1.11 2005/12/06 18:22:31 pietroni
changed FaceType::ComputeNormal and FaceType::ComputeNormalizedNormal
with face::ComputeNormal and face::ComputeNormalizedNormal
Revision 1.10 2005/12/06 15:30:45 ponchio
added #include triangle3.h for Normal(...)
@ -98,7 +102,7 @@ static void PerFace(ComputeMeshType &m)
if( !m.HasPerFaceNormal()) return;
FaceIterator f;
for(f=m.face.begin();f!=m.face.end();++f)
if( !(*f).IsD() ) face::ComputeNormal(*f);
if( !(*f).IsD() ) /*face::*/ComputeNormal(*f);
}

View File

@ -40,6 +40,16 @@
#include <ext/hash_map>
#include <ext/hash_set>
#define STDEXT __gnu_cxx
// It's terrible but gnu's hash_map needs an instantiation of hash() for
// every key type! So we cast the pointer to void*
namespace __gnu_cxx
{
template <> class hash<void *>: private hash<unsigned long>
{
public:
size_t operator()(const void *ptr) const { return hash<unsigned long>::operator()((unsigned long)ptr); }
};
}
#endif
#include <vector>
@ -68,7 +78,11 @@ namespace vcg
typedef OBJECT_TYPE* ObjectPointer;
typedef std::pair< ObjectPointer, int > hPair;
#ifdef __GNUC__
typedef typename STDEXT::hash_map< /*ObjectPointer*/void*, int >::iterator hIterator;
#else
typedef typename STDEXT::hash_map< ObjectPointer, int >::iterator hIterator;
#endif
typedef std::pair< hIterator, bool > hInsertResult;
public:
@ -132,9 +146,13 @@ namespace vcg
}
protected:
#ifdef __GNUC__
STDEXT::hash_map< void*, int > inserted_objects;
#else
STDEXT::hash_map< OBJECT_TYPE*, int > inserted_objects;
#endif
std::vector< DisjointSetNode > nodes;
};
};// end of namespace vcg
#endif //VCG_MATH_UNIONSET_H
#endif //VCG_MATH_UNIONSET_H

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.5 2006/11/07 11:29:24 cignoni
Corrected some errors in the reflections Has*** functions
Revision 1.4 2006/10/31 16:02:59 ganovelli
vesione 2005 compliant
@ -278,7 +281,7 @@ namespace tri
bool HasPerVertexQuality (const TriMesh < vert::vector_ocf< VertType > , FaceContainerType > & m)
{
if(VertType::HasQualityOcf()) return m.vert.IsQualityEnabled();
else return VertexType::HasQuality();
else return VertType::HasQuality();
}
}

View File

@ -236,18 +236,18 @@ namespace vcg
E.push_back(MSTEdge(&tangent_planes[i], iRiemannianEdge->plane, iRiemannianEdge->weight));
std::sort( E.begin(), E.end() );
vcg::DisjointSet<Plane> set;
vcg::DisjointSet<Plane> planeset;
for (typename std::vector< Plane >::iterator iPlane=tangent_planes.begin(); iPlane!=ePlane; iPlane++)
set.MakeSet( &*iPlane );
planeset.MakeSet( &*iPlane );
typename std::vector< MSTEdge >::iterator iMSTEdge = E.begin();
typename std::vector< MSTEdge >::iterator eMSTEdge = E.end();
std::vector< MSTEdge > unoriented_tree;
Plane *u, *v;
for ( ; iMSTEdge!=eMSTEdge; iMSTEdge++)
if ((u=set.FindSet(iMSTEdge->u))!=(v=set.FindSet(iMSTEdge->v)))
unoriented_tree.push_back( *iMSTEdge ), set.Union(u, v);
if ((u=planeset.FindSet(iMSTEdge->u))!=(v=planeset.FindSet(iMSTEdge->v)))
unoriented_tree.push_back( *iMSTEdge ), planeset.Union(u, v);
E.clear();
// compute for each plane the list of sorting edges