This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Indoor/grid/walk/v3/Structs.h
2018-10-25 11:50:12 +02:00

95 lines
2.0 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* © Copyright 2014 Urheberrechtshinweis
* Alle Rechte vorbehalten / All Rights Reserved
*
* Programmcode ist urheberrechtlich geschuetzt.
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
* Keine Verwendung ohne explizite Genehmigung.
* (vgl. § 106 ff UrhG / § 97 UrhG)
*/
#ifndef INDOOR_GW3_STRUCTS_H
#define INDOOR_GW3_STRUCTS_H
#include "../../../geo/Heading.h"
#include "../../../geo/Point3.h"
#include <vector>
#include "../../../math/Distributions.h"
#include "../../../grid/Grid.h"
namespace GW3 {
struct StepSizes {
float stepSizeFloor_m = NAN;
float stepSizeStair_m = NAN;
bool isValid() const {
return (stepSizeFloor_m==stepSizeFloor_m) && (stepSizeStair_m==stepSizeStair_m);
}
template <typename Node> float inMeter(const int steps, const Point3 start, const Grid<Node>& grid) const {
Assert::isTrue(isValid(), "invalid step-sizes given");
const GridPoint gp = grid.toGridPoint(start);
const Node& n = grid.getNodeFor(gp);
if (grid.isPlain(n)) {
return stepSizeFloor_m * steps;
} else {
return stepSizeStair_m * steps;
}
}
};
/** paremters for the walk */
struct WalkParams {
//Distribution::Normal<float> dDistFloor;
//Distribution::Normal<float> dDistStair;
Point3 start;
//float distance_m;
int numSteps;
Heading heading = Heading(0);
float lookFurther_m = 1.5;
StepSizes stepSizes;
template <typename Node> float getDistanceInMeter(const Grid<Node>& grid) const {
return stepSizes.inMeter(numSteps, start, grid);
}
};
/** result of the random walk */
struct WalkResult {
Point3 position;
Heading heading = Heading(0);
double probability = 1.0;
};
/** several nodes */
template <typename Node> struct Nodes : public std::vector<const Node*> {
};
/** one walk along several nodes */
template <typename Node> struct Walk : public std::vector<const Node*> {
};
/** several walks */
template <typename Node> struct Walks : public std::vector<Walk<Node>> {
};
}
#endif // INDOOR_GW3_STRUCTS_H