|
|
|
@ -356,14 +356,15 @@ public class MockRace extends Race {
|
|
|
|
|
|
|
|
|
|
|
|
if (boat.getTimeSinceTackChange() > tackPeriod) {
|
|
|
|
if (boat.getTimeSinceTackChange() > tackPeriod) {
|
|
|
|
//Calculate the new VMG.
|
|
|
|
//Calculate the new VMG.
|
|
|
|
VMG newVMG = boat.getPolars().calculateVMG(
|
|
|
|
// VMG newVMG = boat.getPolars().calculateVMG(
|
|
|
|
this.getWindDirection(),
|
|
|
|
// this.getWindDirection(),
|
|
|
|
this.getWindSpeed(),
|
|
|
|
// this.getWindSpeed(),
|
|
|
|
boat.calculateBearingToNextMarker(),
|
|
|
|
// boat.calculateBearingToNextMarker(),
|
|
|
|
Bearing.fromDegrees(0d),
|
|
|
|
// Bearing.fromDegrees(0d),
|
|
|
|
Bearing.fromDegrees(359.99999d));
|
|
|
|
// Bearing.fromDegrees(359.99999d));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VMG newVMG = boat.getPolars().setBestVMG(this.getWindDirection(), this.getWindSpeed(), boat.getBearing());
|
|
|
|
|
|
|
|
System.out.println(newVMG);
|
|
|
|
//If the new vmg improves velocity, use it.
|
|
|
|
//If the new vmg improves velocity, use it.
|
|
|
|
if (improvesVelocity(boat, newVMG)) {
|
|
|
|
if (improvesVelocity(boat, newVMG)) {
|
|
|
|
boat.setVMG(newVMG);
|
|
|
|
boat.setVMG(newVMG);
|
|
|
|
@ -372,12 +373,13 @@ public class MockRace extends Race {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void setBoatSpeed(MockBoat boat) {
|
|
|
|
private void setBoatSpeed(MockBoat boat) {
|
|
|
|
VMG vmg = boat.getPolars().calculateVMG(
|
|
|
|
// VMG vmg = boat.getPolars().calculateVMG(
|
|
|
|
this.getWindDirection(),
|
|
|
|
// this.getWindDirection(),
|
|
|
|
this.getWindSpeed(),
|
|
|
|
// this.getWindSpeed(),
|
|
|
|
boat.getBearing(),
|
|
|
|
// boat.getBearing(),
|
|
|
|
Bearing.fromDegrees(boat.getBearing().degrees() - 1),
|
|
|
|
// Bearing.fromDegrees(boat.getBearing().degrees() - 1),
|
|
|
|
Bearing.fromDegrees(boat.getBearing().degrees() + 1));
|
|
|
|
// Bearing.fromDegrees(boat.getBearing().degrees() + 1));
|
|
|
|
|
|
|
|
VMG vmg = boat.getPolars().setBestVMG(this.getWindDirection(), this.getWindSpeed(), boat.getBearing());
|
|
|
|
if (vmg.getSpeed() > 0) {
|
|
|
|
if (vmg.getSpeed() > 0) {
|
|
|
|
boat.setCurrentSpeed(vmg.getSpeed());
|
|
|
|
boat.setCurrentSpeed(vmg.getSpeed());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -527,7 +529,7 @@ public class MockRace extends Race {
|
|
|
|
if (boat.isStarboardSide(roundingMark) &&
|
|
|
|
if (boat.isStarboardSide(roundingMark) &&
|
|
|
|
GPSCoordinate.passesLine(roundingMark.getPosition(),
|
|
|
|
GPSCoordinate.passesLine(roundingMark.getPosition(),
|
|
|
|
roundingChecks.get(0), boat.getPosition(), legBearing) &&
|
|
|
|
roundingChecks.get(0), boat.getPosition(), legBearing) &&
|
|
|
|
gateCheck &&
|
|
|
|
gateCheck &&
|
|
|
|
boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) {
|
|
|
|
boat.isBetweenGate(roundingMark, Mark.tempMark(roundingChecks.get(0)))) {
|
|
|
|
boat.increaseRoundingStatus();
|
|
|
|
boat.increaseRoundingStatus();
|
|
|
|
if (boat.getCurrentLeg().getLegNumber() + 2 >= legs.size()){
|
|
|
|
if (boat.getCurrentLeg().getLegNumber() + 2 >= legs.size()){
|
|
|
|
|