Fixed gScore with MaxValue due to Vector Angle returning NaN
This commit is contained in:
@ -205,6 +205,8 @@ public class Pathfinder
|
||||
double v1L = Math.Sqrt(v1.x * v1.x + v1.y * v1.y);
|
||||
double v2L = Math.Sqrt(v2.x * v2.x + v2.y * v2.y);
|
||||
double ang = Math.Acos(dotProd / (v1L * v2L));
|
||||
if (ang.Equals(double.NaN))
|
||||
return 0;
|
||||
double angle = Utils.RadiansToDegrees(ang);
|
||||
return angle;
|
||||
}
|
||||
|
Reference in New Issue
Block a user