Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static PointRC get_FieldRC2(int x, int y)
- {
- boolean minus;
- int cntrow;
- int cntcol;
- int steps = 0;
- int qx = Math.abs(x);
- int qy = (y/16) * 16;
- int modx = qx % 32;
- minus = x < 0 ? true : false;
- if(modx >= 16)
- qx += 32-modx;
- else
- qx -= modx;
- qy = 16 + (y / 32) * 32;
- if(minus)
- qx = -qx;
- if(qx != 0){
- if(minus){
- steps = qx / -32;
- qx += 32 * steps;
- qy += 16 * steps;
- }else{
- steps = qx / 32;
- qx -= 32 * steps;
- qy -= 16 * steps;
- }
- }
- cntrow = qy/32;
- if(minus)
- cntcol = cntrow - steps;
- else
- cntcol = cntrow + steps;
- return new PointRC(cntrow,cntcol);
- }
Add Comment
Please, Sign In to add comment