#![allow(clippy::print_stdout, reason = "example binary")]
use s2rst::s2::{LatLng, Rect};
fn main() {
let r = Rect::from_lat_lng(LatLng::from_degrees(-1.0, -1.0))
.add_point(LatLng::from_degrees(1.0, 1.0));
let print_dist = |lat: f64, lng: f64| {
let d = r.get_distance_to_latlng(LatLng::from_degrees(lat, lng));
println!("{:.6}", d.degrees());
};
println!("Distances next to the rectangle.");
print_dist(-2.0, 0.0);
print_dist(0.0, -2.0);
print_dist(2.0, 0.0);
print_dist(0.0, 2.0);
println!("Distances beyond the corners of the rectangle.");
print_dist(-2.0, -2.0);
print_dist(-2.0, 2.0);
print_dist(2.0, 2.0);
print_dist(2.0, -2.0);
println!("Distance within the rectangle.");
print_dist(0.0, 0.0);
print_dist(0.5, 0.0);
print_dist(0.0, 0.5);
print_dist(-0.5, 0.0);
print_dist(0.0, -0.5);
}