|
|
|
|
@ -49,9 +49,9 @@ public class Race implements Runnable {
|
|
|
|
|
private List<GPSCoordinate> boundary;
|
|
|
|
|
|
|
|
|
|
///Wind direction bearing.
|
|
|
|
|
private double windDirection = 0;
|
|
|
|
|
private double windDirection;
|
|
|
|
|
///Wind speed (knots). Convert this to millimeters per second before passing to RaceStatus.
|
|
|
|
|
private double windSpeed = 0;
|
|
|
|
|
private double windSpeed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -315,6 +315,8 @@ public class Race implements Runnable {
|
|
|
|
|
|
|
|
|
|
boolean finish = boat.getCurrentLeg().getName().equals("Finish");
|
|
|
|
|
if (!finish) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
double totalDistanceTravelledInTack = distanceTravelled + boat.getDistanceTravelledInTack();
|
|
|
|
|
|
|
|
|
|
double bound1 = (boat.calculateBearingToDestination() - 90) % 360;
|
|
|
|
|
@ -343,14 +345,10 @@ public class Race implements Runnable {
|
|
|
|
|
VMG newHeading = boat.getPolars().calculateVMG(this.windDirection, this.windSpeed,
|
|
|
|
|
boat.calculateBearingToDestination(), bound1, bound2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!GPSCoordinate.isInsideBoundary(calculatePosition(boat.getCurrentPosition(),
|
|
|
|
|
// 1, azimuth), boundary)){
|
|
|
|
|
// System.out.println("LDFSGSDFG");
|
|
|
|
|
// double tempHeading = (newHeading.bearing+90)%360;
|
|
|
|
|
// newHeading.bearing = tempHeading;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (!GPSCoordinate.isInsideBoundary(boat.getCurrentPosition(), boundary)){
|
|
|
|
|
double tempHeading = (newHeading.getBearing() - this.windDirection +90)%360;
|
|
|
|
|
newHeading.setBearing(tempHeading);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Is this new VMG better than the current VMG?
|
|
|
|
|
|
|
|
|
|
|