started removing KLib related code:
- assertions - distributions new helper methods worked on stairs worked on grid-walkers worked on navigation
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "../../nav/dijkstra/Dijkstra.h"
|
||||
#include "../../nav/dijkstra/DijkstraPath.h"
|
||||
|
||||
#include <KLib/math/distribution/Normal.h>
|
||||
#include "../../math/Distributions.h"
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
n1.imp = 1.0f;
|
||||
|
||||
n1.imp += getWallImportance(n1, Units::cmToM(std::sqrt(squaredDist[0])) );
|
||||
n1.imp += getWallImportance( Units::cmToM(std::sqrt(squaredDist[0])) );
|
||||
//addDoor(n1, neighbors);
|
||||
|
||||
// is the current node a door?
|
||||
@@ -86,7 +86,7 @@ public:
|
||||
// process each node again
|
||||
for (T& n1 : g) {
|
||||
|
||||
static K::NormalDistribution favorDoors(0.0, 1.0);
|
||||
static Distribution::Normal<float> favorDoors(0.0f, 1.0f);
|
||||
|
||||
// get the distance to the nearest door
|
||||
const float dist_m = Units::cmToM(knnDoors.getNearestDistance( {n1.x_cm, n1.y_cm, n1.z_cm} ));
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
//T& node = g[idx];
|
||||
const float dist_cm = knn.getNearestDistance( {n.x_cm, n.y_cm, n.z_cm} );
|
||||
const float dist_m = Units::cmToM(dist_cm);
|
||||
n.impPath = 1.0 + K::NormalDistribution::getProbability(0, 1.0, dist_m) * 0.8;
|
||||
n.impPath = 1.0 + Distribution::Normal<float>::getProbability(0, 1.0, dist_m) * 0.8;
|
||||
|
||||
|
||||
}
|
||||
@@ -191,16 +191,16 @@ public:
|
||||
}
|
||||
|
||||
/** get the importance of the given node depending on its nearest wall */
|
||||
template <typename T> float getWallImportance(T& nSrc, float dist_m) {
|
||||
float getWallImportance(float dist_m) {
|
||||
|
||||
// avoid sticking too close to walls (unlikely)
|
||||
static K::NormalDistribution avoidWalls(0.0, 0.4);
|
||||
static Distribution::Normal<float> avoidWalls(0.0, 0.4);
|
||||
|
||||
// favour walking near walls (likely)
|
||||
static K::NormalDistribution sticToWalls(0.9, 0.5);
|
||||
static Distribution::Normal<float> sticToWalls(0.9, 0.5);
|
||||
|
||||
// favour walking far away (likely)
|
||||
static K::NormalDistribution farAway(2.2, 0.5);
|
||||
static Distribution::Normal<float> farAway(2.2, 0.5);
|
||||
if (dist_m > 2.0) {dist_m = 2.0;}
|
||||
|
||||
// overall importance
|
||||
|
||||
Reference in New Issue
Block a user