public static void calcPoints ( final double lat1 , final double lon1 , final double lat2 , final double lon2 , final PointEmitter emitter , final double offsetLat , final double offsetLon , final double deltaLat , final double deltaLon ) { // round to make results of bresenham closer to correct solution int y1 = ( int ) ( ( lat1 - offsetLat ) / deltaLat ) ; int x1 = ( int ) ( ( lon1 - offsetLon ) / deltaLon ) ; int y2 = ( int ) ( ( lat2 - offsetLat ) / deltaLat ) ; int x2 = ( int ) ( ( lon2 - offsetLon ) / deltaLon ) ; bresenham ( y1 , x1 , y2 , x2 , new PointEmitter ( ) { @ Override public void set ( double lat , double lon ) { // +.1 to move more near the center of the tile emitter . set ( ( lat + .1 ) * deltaLat + offsetLat , ( lon + .1 ) * deltaLon + offsetLon ) ; } } ) ; }
Calls the Bresenham algorithm but make it working for double values