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

@@ -26,23 +26,23 @@ public:
bool getSegmentIntersection(const Line2& other) const {
const double bx = p2.x - p1.x;
const double by = p2.y - p1.y;
const float bx = p2.x - p1.x;
const float by = p2.y - p1.y;
const double dx = other.p2.x - other.p1.x;
const double dy = other.p2.y - other.p1.y;
const float dx = other.p2.x - other.p1.x;
const float dy = other.p2.y - other.p1.y;
const double b_dot_d_perp = bx*dy - by*dx;
const float b_dot_d_perp = bx*dy - by*dx;
if(b_dot_d_perp == 0) {return false;}
if (b_dot_d_perp == 0) {return false;}
const double cx = other.p1.x - p1.x;
const double cy = other.p1.y - p1.y;
const float cx = other.p1.x - p1.x;
const float cy = other.p1.y - p1.y;
const double t = (cx * dy - cy * dx) / b_dot_d_perp;
const float t = (cx * dy - cy * dx) / b_dot_d_perp;
if(t < 0 || t > 1) {return false;}
const double u = (cx * by - cy * bx) / b_dot_d_perp;
const float u = (cx * by - cy * bx) / b_dot_d_perp;
if(u < 0 || u > 1) {return false;}
return true;