From cbc36cf14775b7c51b608d259a8c41da9c52d769 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 25 Nov 2013 10:40:33 +0000 Subject: [PATCH] Include header cleaning and reordering. --- vcg/complex/algorithms/edge_collapse.h | 117 ++++++++++++------------- vcg/complex/algorithms/nring.h | 22 +++-- vcg/complex/algorithms/stat.h | 17 ---- 3 files changed, 68 insertions(+), 88 deletions(-) diff --git a/vcg/complex/algorithms/edge_collapse.h b/vcg/complex/algorithms/edge_collapse.h index 3dd8ae0a..959c5929 100644 --- a/vcg/complex/algorithms/edge_collapse.h +++ b/vcg/complex/algorithms/edge_collapse.h @@ -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 #include -#include 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 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 EdgeVec; - ///of VFIterator - typedef typename vcg::face::VFIterator VFI; - /// vector of VFIterator - typedef typename std::vector > VFIVec; + ///of VFIterator + typedef typename vcg::face::VFIterator VFI; + /// vector of VFIterator + typedef typename std::vector > 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 &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::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::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::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::DeleteVertex(m,*(c.V(0))); + c.V(1)->P()=p; + return n_face_del; + } }; } } -#endif +#endif diff --git a/vcg/complex/algorithms/nring.h b/vcg/complex/algorithms/nring.h index db8706f3..b164186a 100644 --- a/vcg/complex/algorithms/nring.h +++ b/vcg/complex/algorithms/nring.h @@ -25,21 +25,19 @@ ****************************************************************************/ #include -#include #include -#include 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 Nring { @@ -67,10 +65,10 @@ public: insertAndFlag(v); } - + ~Nring() { - clear(); + clear(); } void insertAndFlag1Ring(VertexType* v) diff --git a/vcg/complex/algorithms/stat.h b/vcg/complex/algorithms/stat.h index 416db292..95e2de19 100644 --- a/vcg/complex/algorithms/stat.h +++ b/vcg/complex/algorithms/stat.h @@ -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 #include #include -#include #include #include -#include -#include namespace vcg {