00001 // -*- C++ -*- 00002 00003 #ifndef __MOBILITY_H__ 00004 #define __MOBILITY_H__ 00005 00006 #include <vector> 00007 #include "Configuration.h" 00008 00009 namespace PathEngine { 00010 00011 class PathPlanner; 00012 class Mobility; 00013 00017 typedef Mobility* (*MobilityNewFunc)(PathPlanner* planner); 00018 00022 typedef void (*MobilityDeleteFunc)(Mobility* mobility); 00023 00027 template <class _New> 00028 Mobility* MobilityCreate(PathPlanner* planner) { 00029 return new _New(planner); 00030 } 00031 00035 template <class _Delete> 00036 void MobilityDelete(Mobility* mobility) { 00037 delete mobility; 00038 } 00039 00048 class Mobility { 00049 protected: 00056 PathPlanner* planner_; 00057 public: 00062 Mobility(PathPlanner* planner) {planner_ = planner;} 00063 00067 virtual ~Mobility() {;} 00068 00077 virtual bool getPath(Configuration &from, Configuration &to, 00078 std::vector<Configuration> &o_path) const; 00079 00084 virtual bool isReversible() const = 0; 00085 00090 bool isReachable(Configuration& from, Configuration& to, bool checkCollision=true) const; 00091 00099 virtual Configuration interpolate(const Configuration& from, const Configuration& to, double ratio) const = 0; 00100 00107 virtual double distance(const Configuration& from, const Configuration& to) const = 0; 00112 static void interpolationDistance(double d) { interpolationDistance_ = d;} 00113 00118 static double interpolationDistance() { return interpolationDistance_;} 00119 private: 00123 static double interpolationDistance_; 00124 }; 00125 }; 00126 #endif // __MOBILITY_H__