@Test
public void testRealBresenham()
{

    int parts = 4;
    int bits = (int) (Math.log(parts * parts) / Math.log(2));
    double minLon = -1, maxLon = 1.6;
    double minLat = -1, maxLat = 0.5;
    final KeyAlgo keyAlgo = new SpatialKeyAlgo(bits).setBounds(minLon, maxLon, minLat, maxLat);
    double deltaLat = (maxLat - minLat) / parts;
    double deltaLon = (maxLon - minLon) / parts;
    final ArrayList<Long> keys = new ArrayList<Long>();
    PointEmitter tmpEmitter = new PointEmitter()
    {
        @Override
        public void set( double lat, double lon )
        {
            keys.add(keyAlgo.encode(lat, lon));
        }
    };
    keys.clear();
    BresenhamLine.calcPoints(.3, -.3, -0.2, 0.2, tmpEmitter, minLat, minLon,
            deltaLat, deltaLon);
    assertEquals(Arrays.asList(11L, 9L), keys);
    keys.clear();
    BresenhamLine.calcPoints(.3, -.1, -0.2, 0.4, tmpEmitter, minLat, minLon,
            deltaLat, deltaLon);
    // 11, 9, 12
    assertEquals(Arrays.asList(11L, 12L), keys);
    keys.clear();
    BresenhamLine.calcPoints(.5, -.5, -0.1, 0.9, tmpEmitter, minLat, minLon,
            deltaLat, deltaLon);
    // precise: 10, 11, 14, 12
    assertEquals(Arrays.asList(10L, 11L, 12L), keys);
}