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

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

Loading…
Cancel
Save