boats now bounce on the boundry

#pair[hba56, cbt24, jjg64]
 #story[873]
main
hba56 9 years ago
parent 572e54b076
commit 12b6f49f2e

@ -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?

@ -42,4 +42,8 @@ public class VMG {
public double getBearing() {
return bearing;
}
public void setBearing(double bearing) {
this.bearing = bearing;
}
}

Loading…
Cancel
Save