From a8d6bb38edf24fb00c0f0571e9f341897ccc1717 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Thu, 29 Jun 2006 13:02:38 +0000 Subject: [PATCH] agiunta UpdateBoundingBase, superclasse di UpdateBounding, templated sul container di vertici. --- vcg/complex/vertexmesh/update/bounding.h | 39 ++++++++++++++++-------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/vcg/complex/vertexmesh/update/bounding.h b/vcg/complex/vertexmesh/update/bounding.h index efc5ff25..2df7eb66 100644 --- a/vcg/complex/vertexmesh/update/bounding.h +++ b/vcg/complex/vertexmesh/update/bounding.h @@ -24,11 +24,16 @@ History $Log: not supported by cvs2svn $ +Revision 1.1 2005/03/09 13:22:55 ganovelli +creation + ****************************************************************************/ #ifndef __VCG_POINT_UPDATE_BOUNDING #define __VCG_POINT_UPDATE_BOUNDING +#include + namespace vcg { namespace vertex { @@ -37,29 +42,39 @@ namespace vertex { /// Management, updating and computation of per-vertex and per-face normals. /// This class is used to compute or update the normals that can be stored in the vertex or face component of a mesh. -template -class UpdateBounding +template +class UpdateBoundingBase { public: -typedef ComputeMeshType MeshType; -typedef typename MeshType::VertexType VertexType; -typedef typename MeshType::VertexPointer VertexPointer; -typedef typename MeshType::VertexIterator VertexIterator; +typedef typename VERTEX_CONTAINER::value_type VertexType; +typedef typename VERTEX_CONTAINER::value_type * VertexPointer; +typedef typename VERTEX_CONTAINER::iterator VertexIterator; +typedef typename VERTEX_CONTAINER::value_type::ScalarType ScalarType; /// Calculates the vertex normal (if stored in the current face type) -static void Box(ComputeMeshType &m) +static Box3 Box(VERTEX_CONTAINER &vert) { - m.bbox.SetNull(); + Box3 res;res.SetNull(); VertexIterator vi; - for(vi=m.vert.begin();vi!=m.vert.end();++vi) - if( !(*vi).IsD() ) m.bbox.Add((*vi).P()); - + for(vi= vert.begin();vi!= vert.end();++vi) + if( !(*vi).IsD() ) res.Add((*vi).P()); + return res; } - }; // end class +template +class UpdateBounding: public UpdateBoundingBase { + public: + typedef typename VMType::VertexContainer VertexContainer; + + static void Box(VMType &vm){ + vm.bbox = UpdateBoundingBase::Box(vm.vert); + } + +}; + } // End namespace } // End namespace