
20 Feb
2009
20 Feb
'09
12:03 a.m.
Why does the line clipper add a tiddly amount (d) in these expressions? double d = 0.00001; if (t[0] > 0) ends[0] = new Coord((int) (y0 + t[0] * dy + d), (int) (x0 + t[0] * dx + d)); if (t[1] < 1) ends[1] = new Coord((int)(y0 + t[1] * dy + d), (int) (x0 + t[1] * dx + d)); On a similar note, why have the non-zero DELTA here? public static int toMapUnit(double l) { double DELTA = 0.000001; // TODO check if we really mean this if (l > 0) return (int) ((l + DELTA) * (1 << 24)/360); else return (int) ((l - DELTA) * (1 << 24)/360); }