dijkstra is now bleching fast

deleting from the grid is now bleaching fast
added new helper methods
many new test-cases
many new methods for geo classes and others
added a bunch of new grid-walkers
This commit is contained in:
2016-01-26 18:13:30 +01:00
parent b503fb9bdc
commit e6329e1db4
26 changed files with 824 additions and 179 deletions

View File

@@ -2,6 +2,7 @@
#define POINT3_H
#include <KLib/Assertions.h>
#include <cmath>
/**
* 3D Point
@@ -28,6 +29,12 @@ struct Point3 {
Point3& operator /= (const float v) {x/=v; y/=v; z/=v; return *this;}
Point3& operator += (const Point3& o) {x+=o.x; y+=o.y; z+=o.z; return *this;}
Point3& operator -= (const Point3& o) {x-=o.x; y-=o.y; z-=o.z; return *this;}
bool operator == (const Point3& o) const {return x==o.x && y==o.y && z==o.z;}
/** read-only array access */
float operator [] (const int idx) const {
_assertBetween(idx, 0, 2, "index out of bounds");
@@ -36,6 +43,14 @@ struct Point3 {
return z;
}
/** get the distance between this point and the other one */
float getDistance(const Point3& o) const {
const float dx = x - o.x;
const float dy = y - o.y;
const float dz = z - o.z;
return std::sqrt(dx*dx + dy*dy + dz*dz);
}
float length() const {return std::sqrt(x*x + y*y + z*z);}
float length(const float norm) const {