minor changes to grid walking
This commit is contained in:
12
grid/Grid.h
12
grid/Grid.h
@@ -213,6 +213,14 @@ public:
|
||||
return GridNodeBBox(node, gridSize_cm);
|
||||
}
|
||||
|
||||
/** is this node part of a non-plain stair/escalator */
|
||||
bool isPlain(const T& n1) const {
|
||||
for (const T& n2 : neighbors(n1)) {
|
||||
if (n2.z_cm != n1.z_cm) {return false;}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* get an UID for the given point.
|
||||
* this works only for aligned points.
|
||||
@@ -469,11 +477,11 @@ public:
|
||||
|
||||
|
||||
|
||||
NeighborForEach neighbors(const int idx) {
|
||||
NeighborForEach neighbors(const int idx) const {
|
||||
return neighbors(nodes[idx]);
|
||||
}
|
||||
|
||||
NeighborForEach neighbors(const T& node) {
|
||||
NeighborForEach neighbors(const T& node) const {
|
||||
return NeighborForEach(*this, node._idx);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
/** set the node's semantic type */
|
||||
void setType(const uint8_t type) {this->_type = type;}
|
||||
|
||||
|
||||
// /** get the n-th neighbor for this node */
|
||||
// template <int gridSize_cm, typename T> inline T& getNeighbor(const int nth, const Grid<gridSize_cm, T>& grid) const {
|
||||
// return grid.getNeighbor(_idx, nth);
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace GW3 {
|
||||
if (grid.hasNodeFor(gp)) {
|
||||
res.position = p3; // update position
|
||||
//res.heading; // keep as-is
|
||||
res.probability *= getP(p3); // keep as-is
|
||||
res.probability *= 1;//getP(p3); // keep as-is
|
||||
return res; // done
|
||||
|
||||
} else {
|
||||
@@ -157,7 +157,7 @@ namespace GW3 {
|
||||
}
|
||||
|
||||
res.heading = Heading(start.xy(), end.xy());
|
||||
res.probability *= getP(end);
|
||||
res.probability *= 0.1;//getP(end);
|
||||
res.position = end;
|
||||
return res;
|
||||
|
||||
@@ -237,7 +237,7 @@ namespace GW3 {
|
||||
int numVisitedNodes = 0;
|
||||
|
||||
|
||||
#define MODE 3
|
||||
#define MODE 2
|
||||
|
||||
#if (MODE == 1)
|
||||
|
||||
@@ -249,9 +249,10 @@ namespace GW3 {
|
||||
|
||||
for (const Node* dstNode : nodes) {
|
||||
const Point3 nodeCenter = Helper::gpToP3(*dstNode);
|
||||
const float walkDist_m = nodeCenter.getDistance(start);//*1.05;
|
||||
double p = 1.0;
|
||||
for (const WalkEvaluator<Node>* eval : evals) {
|
||||
const double p1 = eval->getProbability(start, nodeCenter, params);
|
||||
const double p1 = eval->getProbability(start, nodeCenter, walkDist_m, params);
|
||||
p *= p1;
|
||||
}
|
||||
if (p > bestNodeP) {
|
||||
@@ -284,10 +285,11 @@ namespace GW3 {
|
||||
|
||||
// destination = nodeCenter + offset (within the node's bbox, (x,y) only! keep z as-is)
|
||||
const Point3 end(nodeCenter.x + ox, nodeCenter.y + oy, nodeCenter.z);
|
||||
const float walkDist_m = end.getDistance(start);//*1.05;
|
||||
|
||||
double p = 1;
|
||||
for (const WalkEvaluator<Node>* eval : evals) {
|
||||
const double p1 = eval->getProbability(start, end, params);
|
||||
const double p1 = eval->getProbability(start, end, walkDist_m, params);
|
||||
p *= p1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user