6 #define random() rand() 13 if (path.size() < 3)
return path;
16 int nSegment = path.size()-1;
17 int index1 = ((float)random())/RAND_MAX*nSegment;
20 index2 = ((float)random())/RAND_MAX*nSegment;
21 }
while(index1 == index2);
22 if (index2 < index1) std::swap(index1, index2);
24 double ratio1 = ((double)random())/RAND_MAX;
25 double ratio2 = ((double)random())/RAND_MAX;
31 std::vector<Configuration> optimized;
32 for (
int i=0;
i<=index1;
i++) optimized.push_back(path[
i]);
33 optimized.push_back(cfg1);
34 optimized.push_back(cfg2);
35 for (
unsigned int i=index2+1; i<path.size(); i++) optimized.push_back(path[i]);
Mobility * getMobility()
移動能力を取得する
std::vector< Configuration > optimize(const std::vector< Configuration > &path)
親クラスのドキュメントを参照
bool isReachable(Configuration &from, Configuration &to, bool checkCollision=true) const
fromからtoへ干渉なしに移動可能であるかどうか
virtual Configuration interpolate(const Configuration &from, const Configuration &to, double ratio) const =0