new test cases
worked on all walkers new helper methods new distributions some bugfixes
This commit is contained in:
@@ -43,7 +43,7 @@ public:
|
||||
;
|
||||
}
|
||||
|
||||
GridWalkState<T> getDestination(Grid<T>& grid, const GridWalkState<T> start, const float distance_m) override {
|
||||
GridWalkState<T> getDestination(Grid<T>& grid, const GridWalkState<T>& start, const float distance_m) override {
|
||||
|
||||
return GridWalkHelper::retryOrInvert(*this, 2, grid, start, distance_m);
|
||||
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
// NOTE: allocate >>ONCE<<! otherwise random numbers will NOT work!
|
||||
DrawList<T*> drawer;
|
||||
|
||||
GridWalkState<T> walk(Grid<T>& grid, const GridWalkState<T> cur, float distRest_m) {
|
||||
GridWalkState<T> walk(Grid<T>& grid, const GridWalkState<T>& cur, float distRest_m) {
|
||||
|
||||
drawer.reset();
|
||||
|
||||
@@ -93,7 +93,8 @@ private:
|
||||
// all neighbors are unlikely? -> start over
|
||||
if (drawer.getCumProbability() < 0.01) {return GridWalkState<T>();}
|
||||
|
||||
GridWalkState<T> next;
|
||||
// create a copy (to keep heading and walked distance)
|
||||
GridWalkState<T> next = cur;
|
||||
|
||||
// pick the neighbor best matching this new heading
|
||||
next.node = drawer.get();
|
||||
@@ -103,7 +104,12 @@ private:
|
||||
next.avg = (cur.avg * 0.9) + (Point3(next.node->x_cm, next.node->y_cm, next.node->z_cm) * 0.1);
|
||||
|
||||
// get the distance up to this neighbor
|
||||
distRest_m -= next.node->getDistanceInMeter(*cur.node);
|
||||
const float walked_m = next.node->getDistanceInMeter(*cur.node);
|
||||
distRest_m -= walked_m;
|
||||
|
||||
// update the heading-change and walked-distance
|
||||
next.headingChange_rad += next.heading.getRAD() - cur.heading.getRAD();
|
||||
next.distanceWalked_m += walked_m;
|
||||
|
||||
// done?
|
||||
if (distRest_m <= 0) {return next;}
|
||||
|
||||
Reference in New Issue
Block a user