com.strangelight.misc.hex
Class HexGrid
java.lang.Object
|
+--com.strangelight.misc.hex.HexGrid
- All Implemented Interfaces:
- _Testable
- public class HexGrid
- extends java.lang.Object
- implements _Testable
A hexagonal grid of hexagonal cells or tiles.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ROOT_3_OVER_2
protected static final float ROOT_3_OVER_2
SINGLE_CELL_ASCII_ART
protected static final java.lang.String[] SINGLE_CELL_ASCII_ART
- A rough "ASCII-art" representation of a single cell.
HexGrid
public HexGrid()
getAsciiDisplay
public java.lang.String getAsciiDisplay(int columns,
int rows)
- This new batch of bud butter is really yummy.
- Parameters:
columns - the number of columns across to display.rows - the number of rows down to display
setCellSize
public void setCellSize(float size)
- Sets the size of a single cell on our grid. Cells are measured from
the centers of opposite sides, not from the vertices. That is, in the following
diagram, the unit size would be
Y, not X:
|<--- X --->|
--- -----
^ / \
| / \
Y
| \ /
v \ /
--- -----
- Parameters:
size - the new size of a single hexagonal cell.- See Also:
getCellSize()
getCellSize
public float getCellSize()
- Returns:
- the size of a single cell on our grid. Cells are measured from
the centers of opposite sides, not from the vertices. That is, in the following
diagram, the unit size would be
Y, not X:
|<--- X --->|
--- -----
^ / \
| / \
Y
| \ /
v \ /
--- -----
- See Also:
setCellSize(float)
_test_class
public static void _test_class()
throws java.lang.Exception
java.lang.Exception- See Also:
_Testable