starboard rounding update

#story[1101]
main
hba56 8 years ago
parent d70a711a3d
commit 62e37489ee

@ -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;
}

@ -11,7 +11,7 @@
<Corner SeqID="1" CompoundMarkID="1" Rounding="SP" ZoneSize="3" />
<Corner SeqID="2" CompoundMarkID="2" Rounding="Port" ZoneSize="3" />
<Corner SeqID="3" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
<Corner SeqID="4" CompoundMarkID="3" Rounding="Port" ZoneSize="3" />
<Corner SeqID="4" CompoundMarkID="3" Rounding="Starboard" ZoneSize="3" />
<Corner SeqID="5" CompoundMarkID="4" Rounding="Port" ZoneSize="3" />
<Corner SeqID="6" CompoundMarkID="5" Rounding="SP" ZoneSize="3"/>
</CompoundMarkSequence>

Loading…
Cancel
Save