added walker sanity checks

This commit is contained in:
2018-01-27 12:23:37 +01:00
parent e44d3421de
commit d8b91cf144
5 changed files with 32 additions and 0 deletions

View File

@@ -64,6 +64,10 @@ namespace NM {
return _toBeWalkedDistance;
}
void check() const {
Assert::isFalse(numSteps == 0, "num Steps = 0 is currently not supported. must be >= 1");
}
private:
// precalc

View File

@@ -50,6 +50,9 @@ namespace NM {
ResultEntry getOne(const NavMeshWalkParams<Tria>& params) const {
// sanity checks
params.check();
ResultEntry res;
res.probability = 0;
@@ -94,6 +97,9 @@ namespace NM {
ResultList getMany(const NavMeshWalkParams<Tria>& params) const {
// sanity checks
params.check();
ResultList res;
// to-be-walked distance;

View File

@@ -50,6 +50,9 @@ namespace NM {
ResultEntry getOne(const NavMeshWalkParams<Tria>& params) {
// sanity checks
params.check();
ResultEntry re;
static Distribution::Uniform<float> dHead(-0.10, +0.10, 1337);
@@ -117,7 +120,12 @@ namespace NM {
}
ResultList getMany(const NavMeshWalkParams<Tria>& params) {
// sanity checks
params.check();
return {getOne(params)};
}

View File

@@ -53,6 +53,9 @@ namespace NM {
ResultEntry getOne(const NavMeshWalkParams<Tria>& params) const {
// sanity checks
params.check();
static Distribution::Normal<float> dDist(1.0, 0.4);
static Distribution::Normal<float> dHead(0.0, 1.0);
@@ -106,6 +109,9 @@ namespace NM {
ResultList getMany(const NavMeshWalkParams<Tria>& params) const {
// sanity checks
params.check();
static Distribution::Normal<float> dDist(1.0, 0.4);
static Distribution::Normal<float> dHead(0.0, 1.0);

View File

@@ -52,6 +52,9 @@ namespace NM {
ResultEntry getOne(const NavMeshWalkParams<Tria>& params) {
// sanity checks
params.check();
ResultEntry re;
// to-be-walked distance;
@@ -103,7 +106,12 @@ namespace NM {
}
ResultList getMany(const NavMeshWalkParams<Tria>& params) {
// sanity checks
params.check();
return {getOne(params)};
}