-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Description
Please correct me if my assumptions or test is incorrect.
use geo::prelude::*;
use geo::point;
use approx::assert_abs_diff_eq;
fn main() {
// Make sure midpoint returned when at high latitudes
use geo::Geodesic;
let pt_a = point!(x: 0.0, y: 80.0);
let pt_b = point!(x: 179.99, y: 80.0);
let ln = geo::Line::new(pt_a, pt_b);
let d = Geodesic::distance(pt_a, pt_b);
let midpoint = Geodesic::point_at_ratio_between(pt_a, pt_b, 0.5);
eprintln!("the midpoint is {:?}", midpoint);
let closest_point = {
let closest_res = ln.haversine_closest_point(&midpoint);
use geo::Closest::*;
match closest_res {
Intersection(p) => p,
SinglePoint(p) => p,
Indeterminate => {
panic!("Indeterminate");
}
}
};
assert_abs_diff_eq!(closest_point.y(), midpoint.y(), epsilon = 1e-6);
assert_abs_diff_eq!(closest_point.x(), midpoint.x(), epsilon = 1e-6);
}The returned closest point is neither the input point or on the geodesic line.
again, please correct me if I've done something incorrect here.
Metadata
Metadata
Assignees
Labels
No labels
