
On Feb 11, 2009, at 17:19, Robert Vollmert wrote:
Something along these lines might help (doesn't as is, but no time):
This compiles, at least, and probably does what I want: Index: src/uk/me/parabola/imgfmt/app/trergn/LinePreparer.java =================================================================== --- src/uk/me/parabola/imgfmt/app/trergn/LinePreparer.java (revision 877) +++ src/uk/me/parabola/imgfmt/app/trergn/LinePreparer.java (working copy) @@ -200,8 +200,12 @@ continue; } - int dx = lon - lastLong; - int dy = lat - lastLat; + // calculate normalized differences + int max = 1 << (24-shift); + int dx = (lon - lastLong) % (1 << (24-shift)); + if (dx >= max/2) dx -= max/2; + int dy = (lat - lastLat) % (1 << (24-shift)); + if (dy >= max/2) dy -= max/2; lastLong = lon; lastLat = lat;