diff --git a/WaypointCompass/app/src/main/java/com/example/josh/waypointcompass/Display.java b/WaypointCompass/app/src/main/java/com/example/josh/waypointcompass/Display.java index 50bf51c..b3da7e9 100755 --- a/WaypointCompass/app/src/main/java/com/example/josh/waypointcompass/Display.java +++ b/WaypointCompass/app/src/main/java/com/example/josh/waypointcompass/Display.java @@ -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; } @@ -319,4 +319,4 @@ protected Double doInBackground(Double... doubles) { return 0.0; } } -} \ No newline at end of file +}