added PointScaledDistanceFunctor

This commit is contained in:
ganovelli 2011-12-21 16:15:32 +00:00
parent c097e6edd5
commit d256abfaaf
1 changed files with 26 additions and 0 deletions

View File

@ -105,6 +105,32 @@ class PointNormalDistanceFunctor {
}
};
template <class VERTEXYPE>
class PointScaledDistanceFunctor {
public:
typedef typename VERTEXYPE::ScalarType ScalarType;
typedef Point3<ScalarType> QueryType;
static inline const Point3<ScalarType> & Pos(const QueryType & qt) {return qt;}
static Point3<ScalarType> & Cen(){static Point3<ScalarType> cen(0,0,0); return cen;}
inline bool operator () (const VERTEXYPE & p, const QueryType & qp, ScalarType & minDist, Point3<ScalarType> & q) {
Point3<ScalarType> ed = (qp-p.P());
Point3<ScalarType> dir = (p.P()-Cen()).Normalize();
Point3<ScalarType> odir = (dir^((ed)^dir)).Normalize();
ScalarType d = fabs(ed * dir) + fabs(ed *odir);
if(d < minDist){
minDist = d;
q = p.P();
return true;
}
return false;
}
};
template <class VertexType>
class ApproximateGeodesicDistanceFunctor {
public: