worked on signal-strength-estimation
add this information to grid nodes evaluate this information new test-cases
This commit is contained in:
4
grid/DefaultGridNode.h
Normal file
4
grid/DefaultGridNode.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#ifndef DEFAULTGRIDNODE_H
|
||||
#define DEFAULTGRIDNODE_H
|
||||
|
||||
#endif // DEFAULTGRIDNODE_H
|
||||
@@ -24,14 +24,18 @@ private:
|
||||
/** INTERNAL: node's index array-index */
|
||||
int _idx;
|
||||
|
||||
/** semantic annotation for this node */
|
||||
uint8_t _type;
|
||||
/** INTERNAL: store neighbors (via index) */
|
||||
int _neighbors[10];
|
||||
|
||||
/** INTERNAL: number of neighbors */
|
||||
uint8_t _numNeighbors;
|
||||
|
||||
/** INTERNAL: store neighbors (via index) */
|
||||
int _neighbors[10];
|
||||
/** semantic annotation for this node */
|
||||
uint8_t _type;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public:
|
||||
@@ -43,7 +47,9 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
GridNode() : _idx(-1), _numNeighbors(0), _neighbors() {;}
|
||||
/** ctor */
|
||||
GridNode() : _idx(-1), _neighbors(), _numNeighbors(0), _type(0) {;}
|
||||
|
||||
|
||||
/** get the node's index within its grid */
|
||||
int getIdx() const {return _idx;}
|
||||
|
||||
@@ -48,8 +48,15 @@ struct GridPoint {
|
||||
return std::sqrt(dx*dx + dy*dy + dz*dz);
|
||||
}
|
||||
|
||||
/** cast to Point3 */
|
||||
operator Point3() const {return Point3(x_cm, y_cm, z_cm);}
|
||||
///** cast to Point3 */
|
||||
//operator Point3() const {return Point3(x_cm, y_cm, z_cm);}
|
||||
|
||||
/** convert to Point3 in centimeter */
|
||||
Point3 inCentimeter() const {return Point3(x_cm, y_cm, z_cm);}
|
||||
|
||||
/** convert to Point3 in meter */
|
||||
Point3 inMeter() const {return Point3(x_cm/100.0f, y_cm/100.0f, z_cm/100.0f);}
|
||||
|
||||
|
||||
/** cast to string */
|
||||
operator std::string() const {return "(" + std::to_string(x_cm) + "," + std::to_string(y_cm) + "," + std::to_string(z_cm) + ")";}
|
||||
|
||||
@@ -159,12 +159,12 @@ public:
|
||||
template <typename T> bool isDoor( T& nSrc, std::vector<T*> neighbors ) {
|
||||
|
||||
MiniMat2 m;
|
||||
Point3 center = nSrc;
|
||||
Point3 center = nSrc.inCentimeter();
|
||||
|
||||
// calculate the centroid of the nSrc's nearest-neighbors
|
||||
Point3 centroid(0,0,0);
|
||||
for (const T* n : neighbors) {
|
||||
centroid = centroid + (Point3)*n;
|
||||
centroid = centroid + n->inCentimeter();
|
||||
}
|
||||
centroid /= neighbors.size();
|
||||
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
// build covariance of the nearest-neighbors
|
||||
int used = 0;
|
||||
for (const T* n : neighbors) {
|
||||
Point3 d = (Point3)*n - center;
|
||||
Point3 d = n->inCentimeter() - center;
|
||||
if (d.length() > 100) {continue;} // radius search
|
||||
m.addSquared(d.x, d.y);
|
||||
++used;
|
||||
|
||||
Reference in New Issue
Block a user