00001 // -*- C++ -*- 00002 00003 #ifndef __MOBILITY_H__ 00004 #define __MOBILITY_H__ 00005 00006 #include <vector> 00007 #include "Configuration.h" 00008 00009 namespace PathEngine { 00010 class PathPlanner; 00011 00020 class Mobility { 00021 protected: 00028 PathPlanner* planner_; 00029 public: 00034 Mobility(PathPlanner* planner) {planner_ = planner;} 00035 00039 virtual ~Mobility() {;} 00040 00049 virtual bool getPath(Configuration &from, Configuration &to, 00050 std::vector<Configuration> &o_path) const; 00051 00056 virtual bool isReversible() const = 0; 00057 00062 bool isReachable(Configuration& from, Configuration& to, bool checkCollision=true) const; 00063 00071 virtual Configuration interpolate(const Configuration& from, const Configuration& to, double ratio) const = 0; 00072 00079 virtual double distance(const Configuration& from, const Configuration& to) const = 0; 00084 static void interpolationDistance(double d) { interpolationDistance_ = d;} 00085 00090 static double interpolationDistance() { return interpolationDistance_;} 00091 private: 00095 static double interpolationDistance_; 00096 }; 00097 00101 typedef Mobility* (*MobilityNewFunc)(PathPlanner* planner); 00102 00106 typedef void (*MobilityDeleteFunc)(Mobility* mobility); 00107 00111 template <class _New> 00112 Mobility* MobilityCreate(PathPlanner* planner) { 00113 return new _New(planner); 00114 } 00115 00119 template <class _Delete> 00120 void MobilityDelete(Mobility* mobility) { 00121 delete mobility; 00122 } 00123 }; 00124 #endif // __MOBILITY_H__