private static final int gridWidth = 6;
private static final int firstHeight = 64;
private static final int secondHeight = 32;
public static Coords getXY(int cellNumber)
{
int X = some math magic;
int y = some math magic;
int pixelX = some math magic;
int pixelY = some math magic;
return new Coords(x, y);
}
I need a function that returns X,Y coords from just the cell number. The problem here is that speed optimisation is very crutial so I'm not allowed to use any for
loops. Only math equations.
To make things even worse, I need to multiply later those coords to get the cell's pixel location, but the height of the second row is always half the previous one. For example, the number '16' on the image above should return X=4,Y=3 and when converted to pixels should return X=192,Y=96.
How can I achieve this without using any loops ? Thank you.