Added classes GetBox3Functor and GetBarycenter3Functor.

This commit is contained in:
Marco Di Benedetto 2005-09-29 22:22:59 +00:00
parent 5b15048c38
commit 62893095e0
1 changed files with 22 additions and 0 deletions

View File

@ -25,6 +25,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.1 2005/09/28 20:01:35 m_di_benedetto
First Commit.
****************************************************************************/
@ -34,6 +37,7 @@ $Log: not supported by cvs2svn $
// vcg headers
#include <vcg/math/base.h>
#include <vcg/space/point3.h>
#include <vcg/space/box3.h>
namespace vcg {
@ -57,6 +61,24 @@ public:
}
};
class GetBox3Functor {
public:
template <class OBJTYPE, class SCALARTYPE>
void operator () (const OBJTYPE & obj, Box3<SCALARTYPE> & box) {
Box3<typename OBJTYPE::ScalarType> tb;
obj.GetBBox(tb);
box.Import(tb);
}
};
class GetBarycenter3Functor {
public:
template <class OBJTYPE, class SCALARTYPE>
void operator () (const OBJTYPE & obj, Point3<SCALARTYPE> & bar) {
bar.Import(obj.Barycenter());
}
};
template <class SCALARTYPE>
inline Point3<SCALARTYPE> Abs(const Point3<SCALARTYPE> & p) {
return (Point3<SCALARTYPE>(math::Abs(p[0]), math::Abs(p[1]), math::Abs(p[2])));