function x = getCoord(x, m) if floor(mod(x/m,2))==0 x = mod(x,m); else x = m - mod(x,m); end; return;