DistanceFunctor templated on the type of the query

This commit is contained in:
ganovelli 2008-09-24 08:41:04 +00:00
parent d52199f64c
commit f6da3d936d
1 changed files with 11 additions and 3 deletions

View File

@ -234,8 +234,13 @@ namespace vcg {
return true; return true;
} }
template <class S>
class PointDistanceFunctor { class PointDistanceFunctor {
public: public:
typedef typename S ScalarType;
typedef typename Point3<ScalarType> QueryType;
static inline const Point3<ScalarType> & Pos(const QueryType & qt) {return qt;}
template <class FACETYPE, class SCALARTYPE> template <class FACETYPE, class SCALARTYPE>
inline bool operator () (const FACETYPE & f, const Point3<SCALARTYPE> & p, SCALARTYPE & minDist, Point3<SCALARTYPE> & q) { inline bool operator () (const FACETYPE & f, const Point3<SCALARTYPE> & p, SCALARTYPE & minDist, Point3<SCALARTYPE> & q) {
const Point3<typename FACETYPE::ScalarType> fp = Point3<typename FACETYPE::ScalarType>::Construct(p); const Point3<typename FACETYPE::ScalarType> fp = Point3<typename FACETYPE::ScalarType>::Construct(p);
@ -430,10 +435,13 @@ namespace vcg {
return true; return true;
} }
template <class S>
class PointDistanceBaseFunctor { class PointDistanceBaseFunctor {
public: public:
typedef typename S ScalarType;
typedef Point3<ScalarType> QueryType;
static inline const Point3<ScalarType> & Pos(const Point3<ScalarType> & qt) {return qt;}
template <class FACETYPE, class SCALARTYPE> template <class FACETYPE, class SCALARTYPE>
inline bool operator () (const FACETYPE & f, const Point3<SCALARTYPE> & p, SCALARTYPE & minDist, Point3<SCALARTYPE> & q) { inline bool operator () (const FACETYPE & f, const Point3<SCALARTYPE> & p, SCALARTYPE & minDist, Point3<SCALARTYPE> & q) {
const Point3<typename FACETYPE::ScalarType> fp = Point3<typename FACETYPE::ScalarType>::Construct(p); const Point3<typename FACETYPE::ScalarType> fp = Point3<typename FACETYPE::ScalarType>::Construct(p);