@Test public void testGetTeamOfClosestGoalLine() { ETeamColor leftTeam = Geometry.getNegativeHalfTeam(); assertEquals(leftTeam, NGeometry.getTeamOfClosestGoalLine(Vector2.fromXY(-5, 0))); assertEquals(leftTeam.opposite(), NGeometry.getTeamOfClosestGoalLine(Vector2.fromXY(5, 0))); }
public static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos) { ILineSegment blueGoalLine = NGeometry.getGoal(ETeamColor.BLUE).getGoalLine(); ILineSegment yellowGoalLine = NGeometry.getGoal(ETeamColor.YELLOW).getGoalLine(); if (blueGoalLine.distanceTo(pos) < yellowGoalLine.distanceTo(pos)) { return ETeamColor.BLUE; } return ETeamColor.YELLOW; }
NGeometry { public static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos) { ILineSegment blueGoalLine = NGeometry.getGoal(ETeamColor.BLUE).getGoalLine(); ILineSegment yellowGoalLine = NGeometry.getGoal(ETeamColor.YELLOW).getGoalLine(); if (blueGoalLine.distanceTo(pos) < yellowGoalLine.distanceTo(pos)) { return ETeamColor.BLUE; } return ETeamColor.YELLOW; } }
NGeometry { public static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos) { ILineSegment blueGoalLine = NGeometry.getGoal(ETeamColor.BLUE).getGoalLine(); ILineSegment yellowGoalLine = NGeometry.getGoal(ETeamColor.YELLOW).getGoalLine(); if (blueGoalLine.distanceTo(pos) < yellowGoalLine.distanceTo(pos)) { return ETeamColor.BLUE; } return ETeamColor.YELLOW; } private  NGeometry(); }
NGeometry { public static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos) { ILineSegment blueGoalLine = NGeometry.getGoal(ETeamColor.BLUE).getGoalLine(); ILineSegment yellowGoalLine = NGeometry.getGoal(ETeamColor.YELLOW).getGoalLine(); if (blueGoalLine.distanceTo(pos) < yellowGoalLine.distanceTo(pos)) { return ETeamColor.BLUE; } return ETeamColor.YELLOW; } private  NGeometry(); static Goal getGoal(final ETeamColor color); static IRectangle getField(); static IRectangle getFieldSide(final ETeamColor color); static IPenaltyArea getPenaltyArea(final ETeamColor color); static IVector2 getPenaltyMark(final ETeamColor color); static List<IPenaltyArea> getPenaltyAreas(); static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos); static IVector2 getClosestCorner(final IVector2 pos); static boolean ballInsideGoal(final IVector3 pos); static boolean ballInsideGoal(final IVector3 pos, final double goalLineMarginX, final double goalMarginDepth); static boolean posInsidePenaltyArea(final IVector2 pos, final double margin); }
NGeometry { public static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos) { ILineSegment blueGoalLine = NGeometry.getGoal(ETeamColor.BLUE).getGoalLine(); ILineSegment yellowGoalLine = NGeometry.getGoal(ETeamColor.YELLOW).getGoalLine(); if (blueGoalLine.distanceTo(pos) < yellowGoalLine.distanceTo(pos)) { return ETeamColor.BLUE; } return ETeamColor.YELLOW; } private  NGeometry(); static Goal getGoal(final ETeamColor color); static IRectangle getField(); static IRectangle getFieldSide(final ETeamColor color); static IPenaltyArea getPenaltyArea(final ETeamColor color); static IVector2 getPenaltyMark(final ETeamColor color); static List<IPenaltyArea> getPenaltyAreas(); static ETeamColor getTeamOfClosestGoalLine(final IVector2 pos); static IVector2 getClosestCorner(final IVector2 pos); static boolean ballInsideGoal(final IVector3 pos); static boolean ballInsideGoal(final IVector3 pos, final double goalLineMarginX, final double goalMarginDepth); static boolean posInsidePenaltyArea(final IVector2 pos, final double margin);  }