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 /**************************************************************************** 00025 History 00026 00027 $Log: not supported by cvs2svn $ 00028 Revision 1.3 2005/11/12 18:10:35 cignoni 00029 Removed Abs and LowClampToZero and added comments 00030 00031 Revision 1.2 2005/09/29 22:22:59 m_di_benedetto 00032 Added classes GetBox3Functor and GetBarycenter3Functor. 00033 00034 Revision 1.1 2005/09/28 20:01:35 m_di_benedetto 00035 First Commit. 00036 00037 00038 ****************************************************************************/ 00039 00040 #ifndef __VCGLIB_WRAPUTILS_H 00041 #define __VCGLIB_WRAPUTILS_H 00042 00043 // vcg headers 00044 #include <vcg/math/base.h> 00045 #include <vcg/space/point3.h> 00046 #include <vcg/space/box3.h> 00047 00048 namespace vcg { 00049 00050 class EmptyClass { 00051 public: 00052 typedef EmptyClass ClassType; 00053 }; 00054 00055 class GetPointerFunctor { 00056 public: 00057 typedef GetPointerFunctor ClassType; 00058 00059 template <class T> 00060 inline T * operator () (T & t) { 00061 return (&t); 00062 } 00063 00064 template <class T> 00065 inline T * operator () (T * & t) { 00066 return (t); 00067 } 00068 }; 00071 00072 class GetBox3Functor { 00073 public: 00074 template <class OBJTYPE, class SCALARTYPE> 00075 void operator () (const OBJTYPE & obj, Box3<SCALARTYPE> & box) { 00076 Box3<typename OBJTYPE::ScalarType> tb; 00077 obj.GetBBox(tb); 00078 box.Import(tb); 00079 } 00080 }; 00081 00082 class GetBarycenter3Functor { 00083 public: 00084 template <class OBJTYPE, class SCALARTYPE> 00085 void operator () (const OBJTYPE & obj, Point3<SCALARTYPE> & bar) { 00086 bar.Import(Barycenter<OBJTYPE>(obj)); 00087 } 00088 }; 00089 00090 } // end namespace vcg 00091 00092 #endif // #ifndef __VCGLIB_WRAPUTILS_H