mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Refactor. Taken Rounding logic out of yacht and into game state.
tags: #story[1124]
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user