starboard rounding update
#story[1101]
This commit is contained in:
@@ -474,7 +474,6 @@ public class MockRace extends Race {
|
||||
if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing)) &&
|
||||
GPSCoordinate.passesLine(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing).getPosition(),
|
||||
roundingChecks.get(0), boat.getCurrentPosition(), legBearing)) {
|
||||
System.out.println("true");
|
||||
boat.increaseRoundingStatus();
|
||||
}
|
||||
break;
|
||||
@@ -482,7 +481,7 @@ public class MockRace extends Race {
|
||||
// System.out.println("round 1");
|
||||
if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing)) &&
|
||||
GPSCoordinate.passesLine(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing).getPosition(),
|
||||
roundingChecks.get(1), boat.getCurrentPosition(), Bearing.fromDegrees(legBearing.degrees() - 90))) {//negitive 90 from bearing because of port rounding
|
||||
roundingChecks.get(1), boat.getCurrentPosition(), Bearing.fromDegrees(legBearing.degrees() - 90))) {//negative 90 from bearing because of port rounding
|
||||
boat.increaseRoundingStatus();
|
||||
}
|
||||
break;
|
||||
@@ -501,20 +500,20 @@ public class MockRace extends Race {
|
||||
* @param boat the boat that is rounding a mark
|
||||
* @param roundingChecks the checks to run
|
||||
*/
|
||||
private void boatRoundingCheckStarboard(MockBoat boat, List<GPSCoordinate> roundingChecks){
|
||||
private void boatRoundingCheckStarboard(MockBoat boat, List<GPSCoordinate> roundingChecks, Bearing legBearing){
|
||||
//boats must pass all checks in order to round a mark
|
||||
switch (boat.getRoundingStatus()) {
|
||||
case 0://hasn't started rounding
|
||||
if (boat.isStarboardSide(boat.getCurrentLeg().getEndCompoundMark().getMark1()) &&
|
||||
GPSCoordinate.intersects(boat.getCurrentLeg().getEndCompoundMark().getMark1().getPosition(),
|
||||
roundingChecks.get(0), boat.getCurrentPosition())) {
|
||||
if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing)) &&
|
||||
GPSCoordinate.passesLine(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing).getPosition(),
|
||||
roundingChecks.get(0), boat.getCurrentPosition(), legBearing)) {
|
||||
boat.increaseRoundingStatus();
|
||||
}
|
||||
break;
|
||||
case 1://has been parallel to the mark
|
||||
if (boat.isStarboardSide(boat.getCurrentLeg().getEndCompoundMark().getMark1()) &&
|
||||
GPSCoordinate.intersects(boat.getCurrentLeg().getEndCompoundMark().getMark1().getPosition(),
|
||||
roundingChecks.get(1), boat.getCurrentPosition())) {
|
||||
if (boat.isPortSide(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing)) &&
|
||||
GPSCoordinate.passesLine(boat.getCurrentLeg().getEndCompoundMark().getMarkForRounding(legBearing).getPosition(),
|
||||
roundingChecks.get(1), boat.getCurrentPosition(), Bearing.fromDegrees(legBearing.degrees() + 90))) {//positive 90 from bearing because of starboard rounding
|
||||
boat.increaseRoundingStatus();
|
||||
}
|
||||
break;
|
||||
@@ -560,7 +559,7 @@ public class MockRace extends Race {
|
||||
break;
|
||||
case PS://not yet implemented so these gates will be rounded starboard side
|
||||
case Starboard:
|
||||
boatRoundingCheckStarboard(boat, roundingChecks);
|
||||
boatRoundingCheckStarboard(boat, roundingChecks, bearingOfDirectionLine);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user