updated the race class to set heading based on the vmg not just the end of a leg

-race class now stores the boundary
-updatePositions now checks if the boat is with the course
-update positions now sets heading and speed based on the vmg
-updated azimuth to now accept a start and finish gps rather that finding it itself
-added a calculatebearingtodestination method that finds the azimuth to the dest from the boat
-updated boat tests to use the new azimuth method
 #story[873]
This commit is contained in:
hba56
2017-05-12 12:49:02 +12:00
parent 04fdeaf2e2
commit dd1308808a
3 changed files with 41 additions and 16 deletions
@@ -22,7 +22,7 @@ public class BoatTest {
Marker endMarker = new Marker(new GPSCoordinate(50, 0));
Leg start = new Leg("Start", startMarker, endMarker, 0);
TEST_BOAT.setCurrentLeg(start);
assertEquals(TEST_BOAT.calculateAzimuth(), 0, 1e-8);
assertEquals(TEST_BOAT.calculateAzimuth(startMarker.getAverageGPSCoordinate(), endMarker.getAverageGPSCoordinate()), 0, 1e-8);
}
@Test
@@ -31,7 +31,7 @@ public class BoatTest {
Marker endMarker = new Marker(new GPSCoordinate(-50, 0));
Leg start = new Leg("Start", startMarker, endMarker, 0);
TEST_BOAT.setCurrentLeg(start);
assertEquals(TEST_BOAT.calculateAzimuth(), 180, 1e-8);
assertEquals(TEST_BOAT.calculateAzimuth(startMarker.getAverageGPSCoordinate(), endMarker.getAverageGPSCoordinate()), 180, 1e-8);
}
@@ -42,7 +42,7 @@ public class BoatTest {
Marker endMarker = new Marker(new GPSCoordinate(0, 50));
Leg start = new Leg("Start", startMarker, endMarker, 0);
TEST_BOAT.setCurrentLeg(start);
assertEquals(TEST_BOAT.calculateAzimuth(), 90, 1e-8);
assertEquals(TEST_BOAT.calculateAzimuth(startMarker.getAverageGPSCoordinate(), endMarker.getAverageGPSCoordinate()), 90, 1e-8);
}
@@ -52,7 +52,7 @@ public class BoatTest {
Marker endMarker = new Marker(new GPSCoordinate(0, -50));
Leg start = new Leg("Start", startMarker, endMarker, 0);
TEST_BOAT.setCurrentLeg(start);
assertEquals(TEST_BOAT.calculateAzimuth(), -90, 1e-8);
assertEquals(TEST_BOAT.calculateAzimuth(startMarker.getAverageGPSCoordinate(), endMarker.getAverageGPSCoordinate()), -90, 1e-8);
}