Refactor. Taken Rounding logic out of yacht and into game state.

tags: #story[1124]
This commit is contained in:
William Muir
2017-08-14 23:52:06 +12:00
parent e1dddd317d
commit baacd8a9c0
10 changed files with 439 additions and 317 deletions
@@ -6,6 +6,7 @@ import seng302.model.GeoPoint;
public class GeoUtility {
private static double EARTH_RADIUS = 6378.137;
private static Double MS_TO_KNOTS = 1.943844492;
/**
* Calculates the euclidean distance between two markers on the canvas using xy coordinates
@@ -234,4 +235,20 @@ public class GeoUtility {
return true;
}
/**
* @param boatSpeedInKnots Speed in knots
* @return The Boat speed in millimeters per second
*/
public static Double knotsToMMS(Double boatSpeedInKnots) {
return boatSpeedInKnots / MS_TO_KNOTS * 1000;
}
/**
* @param boatSpeedInMMS Speed in millimeters per second
* @return The Boat speed in knots
*/
public static Double mmsToKnots(Double boatSpeedInMMS) {
return boatSpeedInMMS / 1000 * MS_TO_KNOTS;
}
}