I want to create endless spiral in java like this:
I simply want to send integer from 1-∞ number and get it's spiral map. Example:
getXZForMap(0); ----> (0;0)
getXZForMap(5); ----> (-1;0)
Came up with this code now, but do not know how to go further:
public int[] getXZForMap(int i){
int[] k = new int[2];
if(i > 0){
double s = i/8;
int stage = (int) Math.ceil(s);
int corner_size = ((stage*8)+4)/4;
}
else{
k[0] = 0;
k[1] = 0;
}
return k;
}