Skip to content

Commit

Permalink
Update Display.java
Browse files Browse the repository at this point in the history
  • Loading branch information
josh26turner authored Jul 5, 2021
1 parent 62fa02a commit 421a909
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int findBearingTo(double y1, double x1, double y2, double x2)
double bearing;

if (y > 0) {
if (x > 0) bearing = Math.toDegrees(Math.atan(y / x));
if (x < 0) bearing = Math.toDegrees(Math.atan(y / x));
else if (x > 0) bearing = 180 - Math.toDegrees(Math.atan(-y/x));
else bearing = (180 + Math.toDegrees(Math.atan(y/x))) % 180;
}
Expand Down Expand Up @@ -319,4 +319,4 @@ protected Double doInBackground(Double... doubles) {
return 0.0;
}
}
}
}

0 comments on commit 421a909

Please sign in to comment.