fn split_to_quadrants(source: &BoundingBox) -> [BoundingBox; 4] {
    let midpoint_lat: f64 = (source.sw.latitude + source.ne.latitude) / 2.0f64;
    let midpoint_lon: f64 = (source.sw.longitude + source.ne.longitude) / 2.0f64;

    [
        // Top left
        BoundingBox {
            sw: LatLong {
                latitude: midpoint_lat,
                longitude: source.sw.longitude,
            },
            ne: LatLong {
                latitude: source.ne.latitude,
                longitude: midpoint_lon,
            },
        },
        // Top right
        BoundingBox {
            sw: LatLong {
                latitude: midpoint_lat,
                longitude: midpoint_lon,
            },
            ne: LatLong {
                latitude: source.ne.latitude,
                longitude: source.ne.longitude,
            },
        },
        // Bottom left
        BoundingBox {
            sw: LatLong {
                latitude: source.sw.latitude,
                longitude: source.sw.longitude,
            },
            ne: LatLong {
                latitude: midpoint_lat,
                longitude: midpoint_lon,
            },
        },
        // Bottom right
        BoundingBox {
            sw: LatLong {
                latitude: source.sw.latitude,
                longitude: midpoint_lon,
            },
            ne: LatLong {
                latitude: midpoint_lat,
                longitude: source.ne.longitude,
            },
        },
    ]
}
/// Given a bounding box, split it into four equally distributed sub quadrants.
///
/// This is used for fine grained search within the limits of the Foursquare API. Foursquare will
/// return at most 50 results for any given bounding box, so when we encounter a box that has 50
/// items, we subdivide it and keep trying until all results are known comprehensively.
Given a bounding box, split it into four equally distributed sub quadrants.
This is used for fine grained search within the limits of the Foursquare API. Foursquare will
return at most 50 results for any given bounding box, so when we encounter a box that has 50
items, we subdivide it and keep trying until all results are known comprehensively.
Given a bounding box split it into four equally distributed sub quadrants . This is used for fine grained search within the limits of the Foursquare API . Foursquare will return at most 50 results for any given bounding box so when we encounter a box that has 50 items we subdivide it and keep trying until all results are known comprehensively .
fn split_to_quadrants(source: &BoundingBox) -> [BoundingBox; 4] {
    let midpoint_lat: f64 = (source.sw.latitude + source.ne.latitude) / 2.0f64;
    let midpoint_lon: f64 = (source.sw.longitude + source.ne.longitude) / 2.0f64;
    [
        // Top left
        BoundingBox {
            sw: LatLong {
                latitude: midpoint_lat,
                longitude: source.sw.longitude,
            },
            ne: LatLong {
                latitude: source.ne.latitude,
                longitude: midpoint_lon,
            },
        },
        // Top right
        BoundingBox {
            sw: LatLong {
                latitude: midpoint_lat,
                longitude: midpoint_lon,
            },
            ne: LatLong {
                latitude: source.ne.latitude,
                longitude: source.ne.longitude,
            },
        },
        // Bottom left
        BoundingBox {
            sw: LatLong {
                latitude: source.sw.latitude,
                longitude: source.sw.longitude,
            },
            ne: LatLong {
                latitude: midpoint_lat,
                longitude: midpoint_lon,
            },
        },
        // Bottom right
        BoundingBox {
            sw: LatLong {
                latitude: source.sw.latitude,
                longitude: midpoint_lon,
            },
            ne: LatLong {
                latitude: midpoint_lat,
                longitude: source.ne.longitude,
            },
        },
    ]
}
fn split_to_quadrants ( source : & BoundingBox ) -> [ BoundingBox ; 4 ] { let midpoint_lat : f64 = ( source . sw . latitude + source . ne . latitude ) / 2.0f64 ; let midpoint_lon : f64 = ( source . sw . longitude + source . ne . longitude ) / 2.0f64 ; [ // Top left BoundingBox { sw : LatLong { latitude : midpoint_lat , longitude : source . sw . longitude , } , ne : LatLong { latitude : source . ne . latitude , longitude : midpoint_lon , } , } , // Top right BoundingBox { sw : LatLong { latitude : midpoint_lat , longitude : midpoint_lon , } , ne : LatLong { latitude : source . ne . latitude , longitude : source . ne . longitude , } , } , // Bottom left BoundingBox { sw : LatLong { latitude : source . sw . latitude , longitude : source . sw . longitude , } , ne : LatLong { latitude : midpoint_lat , longitude : midpoint_lon , } , } , // Bottom right BoundingBox { sw : LatLong { latitude : source . sw . latitude , longitude : midpoint_lon , } , ne : LatLong { latitude : midpoint_lat , longitude : source . ne . longitude , } , } , ] }
Given a bounding box, split it into four equally distributed sub quadrants.
Given a bounding box split it into four equally distributed sub quadrants .
source
&BoundingBox
source
&BoundingBox