public class FactPixelMapping extends Object implements PixelMapping
This class cen get instatiated as a singleton with the getInstance() method.
The geometric coordinates stored in the text file to build this map are stored in the "odd -q" vertical layout See http://www.redblobgames.com/grids/hexagons/ for details and pictures.
The coordinates are offset by 22 on the x-axis and by 19 on the y-axis
Modifier and Type | Field and Description |
---|---|
CameraPixel[] |
pixelArray |
Modifier and Type | Method and Description |
---|---|
int |
getChidFromSoftID(int softid) |
int[] |
getCubeCoordinatesFromId(int id) |
static FactPixelMapping |
getInstance() |
CameraPixel[] |
getNeighborsForPixel(CameraPixel p)
Return an array of CameraPixel which direct are neighbours to the pixel passed into this method.
|
CameraPixel[] |
getNeighborsFromID(int id)
Return an array of CameraPixel which are direct neighbours to the pixel ID passed into this method.
|
int |
getNumberCols() |
int |
getNumberOfPixel() |
int |
getNumberRows() |
CameraPixel |
getPixelBelowCoordinatesInMM(double xCoordinate,
double yCoordinate)
Get the CameraPixel sitting below the coordinates passed to the method.
|
CameraPixel |
getPixelFromCubeCoordinates(long x,
long z) |
CameraPixel |
getPixelFromId(int id) |
CameraPixel |
getPixelFromOffsetCoordinates(int x,
int y) |
CameraPixel[] |
getSecondOrderNeighboursForPixel(CameraPixel p)
Return an array of CameraPixel which are the neighbours of the neighbours without the direct neighbours.
|
CameraPixel[] |
getSecondOrderNeighboursFromID(int id)
Return an array of CameraPixel which are the neighbours of the neighbours without the direct neighbours.
|
int |
getSoftIDFromChid(int chid) |
ArrayList<Integer> |
line(int id1,
int id2)
Find lines between two pixels on the hexagonal grid.
|
double |
toDouble(Serializable value) |
public final CameraPixel[] pixelArray
public static FactPixelMapping getInstance()
public int getNumberRows()
public int getNumberCols()
public CameraPixel getPixelBelowCoordinatesInMM(double xCoordinate, double yCoordinate)
xCoordinate
- yCoordinate
- public CameraPixel[] getNeighborsFromID(int id)
id
- the id of pixelpublic CameraPixel[] getNeighborsForPixel(CameraPixel p)
p
- the pixel to get the neighbours frompublic CameraPixel[] getSecondOrderNeighboursFromID(int id)
id
- public CameraPixel[] getSecondOrderNeighboursForPixel(CameraPixel p)
p
- public int[] getCubeCoordinatesFromId(int id)
public CameraPixel getPixelFromCubeCoordinates(long x, long z)
public ArrayList<Integer> line(int id1, int id2)
id1
- id2
- public double toDouble(Serializable value)
public CameraPixel getPixelFromOffsetCoordinates(int x, int y)
getPixelFromOffsetCoordinates
in interface PixelMapping
public int getNumberOfPixel()
getNumberOfPixel
in interface PixelMapping
public CameraPixel getPixelFromId(int id)
getPixelFromId
in interface PixelMapping
public int getChidFromSoftID(int softid)
public int getSoftIDFromChid(int chid)
Copyright © 2019. All rights reserved.