00001 /**************************************************************************** 00002 * VCGLib o o * 00003 * Visual and Computer Graphics Library o o * 00004 * _ O _ * 00005 * Copyright(C) 2004 \/)\/ * 00006 * Visual Computing Lab /\/| * 00007 * ISTI - Italian National Research Council | * 00008 * \ * 00009 * All rights reserved. * 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 * This program is distributed in the hope that it will be useful, * 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00019 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 00020 * for more details. * 00021 * * 00022 ****************************************************************************/ 00023 /**************************************************************************** 00024 History 00025 00026 $Log: not supported by cvs2svn $ 00027 Revision 1.2 2006/06/29 13:02:38 ganovelli 00028 agiunta UpdateBoundingBase, superclasse di UpdateBounding, templated sul container di vertici. 00029 00030 Revision 1.1 2005/03/09 13:22:55 ganovelli 00031 creation 00032 00033 00034 ****************************************************************************/ 00035 #ifndef __VCG_POINT_UPDATE_BOUNDING 00036 #define __VCG_POINT_UPDATE_BOUNDING 00037 00038 #include <vcg/space/box3.h> 00039 00040 namespace vcg { 00041 namespace vrt { 00042 00045 00046 template <class VERTEX_CONTAINER> 00047 class UpdateBoundingBase 00048 { 00049 00050 public: 00051 typedef typename VERTEX_CONTAINER::value_type VertexType; 00052 typedef typename VERTEX_CONTAINER::value_type* VertexPointer; 00053 typedef typename VERTEX_CONTAINER::iterator VertexIterator; 00054 typedef typename VERTEX_CONTAINER::value_type::ScalarType ScalarType; 00055 00056 static Box3<ScalarType> Box(VERTEX_CONTAINER &vert) 00057 { 00058 Box3<ScalarType> res; res.SetNull(); 00059 VertexIterator vi; 00060 for(vi= vert.begin();vi!= vert.end();++vi) 00061 if( !(*vi).IsD() ) res.Add((*vi).P()); 00062 return res; 00063 } 00064 00065 }; // end class UpdateBoundingBase 00066 00067 template <class VMType> 00068 class UpdateBounding: public UpdateBoundingBase<typename VMType::VertexContainer> 00069 { 00070 public: 00071 static void Box(VMType &vm) 00072 { 00073 vm.bbox = UpdateBoundingBase<VMType::VertexContainer>::Box(vm.vert); 00074 } 00075 }; 00076 00077 } // End namespace vert 00078 } // End namespace vcg 00079 00080 00081 #endif