public final class HexagonalGridCalculatorImpl<T extends SatelliteData> extends Object implements HexagonalGridCalculator<T>
| Constructor and Description |
|---|
HexagonalGridCalculatorImpl(HexagonalGrid hexagonalGrid) |
| Modifier and Type | Method and Description |
|---|---|
int |
calculateDistanceBetween(Hexagon hex0,
Hexagon hex1)
Calculates the distance (in hexagons) between two
Hexagon objects on the grid. |
Set<Hexagon<T>> |
calculateMovementRangeFrom(Hexagon<T> hexagon,
int distance)
|
Set<Hexagon<T>> |
calculateRingFrom(Hexagon<T> centerHexagon,
int radius)
|
List<Hexagon<T>> |
drawLine(Hexagon<T> from,
Hexagon<T> to)
|
boolean |
isVisible(Hexagon<T> from,
Hexagon<T> to)
|
Optional<Hexagon<T>> |
rotateHexagon(Hexagon<T> originalHex,
Hexagon<T> targetHex,
RotationDirection rotationDirection)
Returns the Hexagon on the grid which is at the point resulted by rotating the
targetHex's
coordinates around the originalHex by rotationDirection degrees. |
public HexagonalGridCalculatorImpl(HexagonalGrid hexagonalGrid)
public int calculateDistanceBetween(Hexagon hex0, Hexagon hex1)
HexagonalGridCalculatorHexagon objects on the grid.calculateDistanceBetween in interface HexagonalGridCalculator<T extends SatelliteData>hex0 - hex 0hex1 - hex 1public Set<Hexagon<T>> calculateMovementRangeFrom(Hexagon<T> hexagon, int distance)
HexagonalGridCalculatorcalculateMovementRangeFrom in interface HexagonalGridCalculator<T extends SatelliteData>hexagon - Hexagondistance - distanceHexagons within distance (inclusive)public Optional<Hexagon<T>> rotateHexagon(Hexagon<T> originalHex, Hexagon<T> targetHex, RotationDirection rotationDirection)
HexagonalGridCalculatortargetHex's
coordinates around the originalHex by rotationDirection degrees.rotateHexagon in interface HexagonalGridCalculator<T extends SatelliteData>originalHex - center hextargetHex - hex to rotaterotationDirection - direction of the rotationpublic Set<Hexagon<T>> calculateRingFrom(Hexagon<T> centerHexagon, int radius)
HexagonalGridCalculatorcalculateRingFrom in interface HexagonalGridCalculator<T extends SatelliteData>centerHexagon - centerradius - radiuspublic List<Hexagon<T>> drawLine(Hexagon<T> from, Hexagon<T> to)
HexagonalGridCalculatorList of Hexagons which must be traversed in the
given order to go from the from Hexagon to the to Hexagon.drawLine in interface HexagonalGridCalculator<T extends SatelliteData>from - starting hexagonto - target hexagonpublic boolean isVisible(Hexagon<T> from, Hexagon<T> to)
HexagonalGridCalculatorisVisible in interface HexagonalGridCalculator<T extends SatelliteData>from - the Hexagon that we are testing the visibility fromto - the Hexagon from which we are testing the visibility toCopyright © 2016. All rights reserved.