Include header cleaning and reordering.

This commit is contained in:
Paolo Cignoni 2013-11-25 10:40:33 +00:00
parent ae18013dd2
commit cbc36cf147
3 changed files with 68 additions and 88 deletions

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -26,10 +26,9 @@
#include<vcg/simplex/face/pos.h>
#include<vcg/simplex/face/topology.h>
#include<vcg/complex/allocate.h>
namespace vcg{
namespace tri{
namespace tri{
template < class VERTEX_TYPE>
class BasicVertexPair {
@ -46,28 +45,28 @@ private:
/** \addtogroup trimesh */
/*@{*/
/** This a static utility class for the edge collapse.
It provides a common set of useful function for actually making an edge collapse over a trimesh.
/** This a static utility class for the edge collapse.
It provides a common set of useful function for actually making an edge collapse over a trimesh.
See also the corresponding class in the local optimization framework called TriEdgeCollapse
**/
template <class TRI_MESH_TYPE, class VertexPair>
class EdgeCollapser
{
public:
public:
/// The tetrahedral mesh type
typedef TRI_MESH_TYPE TriMeshType;
/// The face type
typedef typename TriMeshType::FaceType FaceType;
/// The vertex type
typedef typename FaceType::VertexType VertexType;
/// The vertex type
typedef typename FaceType::VertexType VertexType;
typedef typename FaceType::VertexPointer VertexPointer;
/// The vertex iterator type
typedef typename TriMeshType::VertexIterator VertexIterator;
/// The tetra iterator type
typedef typename TriMeshType::FaceIterator FaceIterator;
/// The coordinate type
typedef typename FaceType::VertexType::CoordType CoordType;
typedef typename FaceType::VertexType::CoordType CoordType;
/// The scalar type
typedef typename TriMeshType::VertexType::ScalarType ScalarType;
///the container of tetrahedron type
@ -76,12 +75,12 @@ class EdgeCollapser
typedef typename TriMeshType::VertContainer VertContainer;
///half edge type
//typedef typename TriMeshType::FaceType::EdgeType EdgeType;
/// vector of pos
/// vector of pos
// typedef typename std::vector<EdgeType> EdgeVec;
///of VFIterator
typedef typename vcg::face::VFIterator<FaceType> VFI;
/// vector of VFIterator
typedef typename std::vector<vcg::face::VFIterator<FaceType> > VFIVec;
///of VFIterator
typedef typename vcg::face::VFIterator<FaceType> VFI;
/// vector of VFIterator
typedef typename std::vector<vcg::face::VFIterator<FaceType> > VFIVec;
private:
struct EdgeSet
{
@ -92,40 +91,40 @@ private:
};
static void FindSets(VertexPair &p, EdgeSet &es)
{
VertexType * v0 = p.V(0);
VertexType * v1 = p.V(1);
{
VertexType * v0 = p.V(0);
VertexType * v1 = p.V(1);
es.AV0().clear(); // Facce incidenti in v0
es.AV1().clear(); // Facce incidenti in v1
es.AV01().clear(); // Facce incidenti in v0 e v1
VFI x;
for( x.f = v0->VFp(), x.z = v0->VFi(); x.f!=0; ++x)
{
int zv1 = -1;
VFI x;
for(int j=0;j<3;++j)
if( x.f->V(j)==&*v1 ) {
zv1 = j;
break;
}
for( x.f = v0->VFp(), x.z = v0->VFi(); x.f!=0; ++x)
{
int zv1 = -1;
for(int j=0;j<3;++j)
if( x.f->V(j)==&*v1 ) {
zv1 = j;
break;
}
if(zv1==-1) es.AV0().push_back( x ); // la faccia x.f non ha il vertice v1 => e' incidente solo in v0
else es.AV01().push_back( x );
}
}
for( x.f = v1->VFp(), x.z = v1->VFi(); x.f!=0; ++x )
{
int zv0 = -1;
for( x.f = v1->VFp(), x.z = v1->VFi(); x.f!=0; ++x )
{
int zv0 = -1;
for(int j=0;j<3;++j)
if( x.f->V(j)==&*v0 ) {
zv0 = j;
break;
}
for(int j=0;j<3;++j)
if( x.f->V(j)==&*v0 ) {
zv0 = j;
break;
}
if(zv0==-1) es.AV1().push_back( x ); // la faccia x.f non ha il vertice v1 => e' incidente solo in v0
}
}
}
/*
Link Conditions test, as described in
@ -233,39 +232,39 @@ public:
// remember that v[0] will be deleted and v[1] will survive (eventually with a new position)
// hint to do a 'collapse onto a vertex simply pass p as the position of the surviving vertex
static int Do(TriMeshType &m, VertexPair & c, const Point3<ScalarType> &p)
{
{
EdgeSet es;
FindSets(c,es);
typename VFIVec::iterator i;
typename VFIVec::iterator i;
int n_face_del =0 ;
for(i=es.AV01().begin();i!=es.AV01().end();++i)
{
FaceType & f = *((*i).f);
assert(f.V((*i).z) == c.V(0));
vcg::face::VFDetach(f,((*i).z+1)%3);
vcg::face::VFDetach(f,((*i).z+2)%3);
Allocator<TriMeshType>::DeleteFace(m,f);
{
FaceType & f = *((*i).f);
assert(f.V((*i).z) == c.V(0));
vcg::face::VFDetach(f,((*i).z+1)%3);
vcg::face::VFDetach(f,((*i).z+2)%3);
Allocator<TriMeshType>::DeleteFace(m,f);
n_face_del++;
}
//set Vertex Face topology
//set Vertex Face topology
for(i=es.AV0().begin();i!=es.AV0().end();++i)
{
(*i).f->V((*i).z) = c.V(1); // In tutte le facce incidenti in v0, si sostituisce v0 con v1
(*i).f->VFp((*i).z) = (*i).f->V((*i).z)->VFp(); // e appendo la lista di facce incidenti in v1 a questa faccia
(*i).f->VFi((*i).z) = (*i).f->V((*i).z)->VFi();
(*i).f->V((*i).z)->VFp() = (*i).f;
(*i).f->V((*i).z)->VFi() = (*i).z;
}
Allocator<TriMeshType>::DeleteVertex(m,*(c.V(0)));
c.V(1)->P()=p;
return n_face_del;
}
{
(*i).f->V((*i).z) = c.V(1); // In tutte le facce incidenti in v0, si sostituisce v0 con v1
(*i).f->VFp((*i).z) = (*i).f->V((*i).z)->VFp(); // e appendo la lista di facce incidenti in v1 a questa faccia
(*i).f->VFi((*i).z) = (*i).f->V((*i).z)->VFi();
(*i).f->V((*i).z)->VFp() = (*i).f;
(*i).f->V((*i).z)->VFi() = (*i).z;
}
Allocator<TriMeshType>::DeleteVertex(m,*(c.V(0)));
c.V(1)->P()=p;
return n_face_del;
}
};
}
}
#endif
#endif

View File

@ -25,21 +25,19 @@
****************************************************************************/
#include <vcg/simplex/face/jumping_pos.h>
#include <vcg/complex/allocate.h>
#include <vcg/complex/algorithms/update/flag.h>
#include <vector>
namespace vcg
{
namespace tri
namespace tri
{
/** \addtogroup trimesh */
/*@{*/
/*@{*/
/** Class Mesh.
This is class for extracting n-ring of vertexes or faces, starting from a vertex of a mesh.
*/
/** \addtogroup trimesh */
/*@{*/
/*@{*/
/** Class Mesh.
This is class for extracting n-ring of vertexes or faces, starting from a vertex of a mesh.
*/
template <class MeshType>
class Nring
{
@ -67,10 +65,10 @@ public:
insertAndFlag(v);
}
~Nring()
{
clear();
clear();
}
void insertAndFlag1Ring(VertexType* v)

View File

@ -19,20 +19,6 @@
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
* *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.3 2007/01/11 10:12:19 cignoni
Removed useless and conflicting inclusion of face.h
Revision 1.2 2006/05/25 09:39:09 cignoni
missing std and other gcc detected syntax errors
Revision 1.1 2006/05/21 06:59:13 cignoni
Initial Commit
****************************************************************************/
#ifndef __VCGLIB_TRIMESH_STAT
@ -44,11 +30,8 @@ Initial Commit
#include <vcg/math/histogram.h>
#include <vcg/simplex/face/pos.h>
#include <vcg/simplex/face/topology.h>
#include <vcg/complex/complex.h>
#include <vcg/complex/algorithms/closest.h>
#include <vcg/space/index/grid_static_ptr.h>
#include <vcg/complex/allocate.h>
#include <vcg/complex/algorithms/update/flag.h>
namespace vcg {