Browse Source

Changed manhattan function to abs rather than square

master
Macoy Madson 5 years ago
parent
commit
b1515ec588
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      math/math.cpp

+ 2
- 2
math/math.cpp View File

@ -13,10 +13,10 @@ float distanceTo(float aX, float aY, float bX, float bY)
}
float manhattanTo(float aX, float aY, float bX, float bY)
{
//ax-bx sq + ay-by sq
//ax-bx abs + ay-by abs
float x=aX-bX;
float y=aY-bY;
return x*x + y*y;
return fabs(x) + fabs(y);
}
float pointTowards(float aX, float aY, float bX, float bY)
{


Loading…
Cancel
Save