added new methods to the mock boats to let them check which side a mark is on to them

#story[1101]
This commit is contained in:
hba56
2017-08-02 16:33:03 +12:00
parent a8701d8a1f
commit c633de21f5
2 changed files with 175 additions and 2 deletions
@@ -203,4 +203,28 @@ public class MockBoat extends Boat {
return distanceTravelledMeters;
}
/**
* Check if a mark is on the port side of the boat
*/
public boolean isPortSide(Mark mark){
//if this boat is lower than the mark check which way it is facing
if(this.getCurrentPosition().getLongitude() < mark.getPosition().getLongitude()){
return this.getBearing().degrees() <= 180;
}else{
return this.getBearing().degrees() > 180;
}
}
/**
* Check if a mark is on the starboard side of the boat
*/
public boolean isStarboardSide(Mark mark){
//if this boat is lower than the mark check which way it is facing
if(this.getCurrentPosition().getLongitude() < mark.getPosition().getLongitude()){
return this.getBearing().degrees() >= 180;
}else{
return this.getBearing().degrees() < 180;
}
}
}