-
Notifications
You must be signed in to change notification settings - Fork 199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeodesicBearing and HaversineBearing return result #1161
base: main
Are you sure you want to change the base?
GeodesicBearing and HaversineBearing return result #1161
Conversation
@@ -44,8 +44,8 @@ where | |||
fn cross_track_distance(&self, line_point_a: &Point<T>, line_point_b: &Point<T>) -> T { | |||
let mean_earth_radius = T::from(MEAN_EARTH_RADIUS).unwrap(); | |||
let l_delta_13: T = line_point_a.haversine_distance(self) / mean_earth_radius; | |||
let theta_13: T = line_point_a.haversine_bearing(*self).to_radians(); | |||
let theta_12: T = line_point_a.haversine_bearing(*line_point_b).to_radians(); | |||
let theta_13: T = line_point_a.haversine_bearing(*self).unwrap().to_radians(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would change the signature of this function so that it also returns Result
@@ -102,14 +102,14 @@ where | |||
} | |||
|
|||
let pi = T::from(std::f64::consts::PI).unwrap(); | |||
let crs_ad = p1.haversine_bearing(*from).to_radians(); | |||
let crs_ab = p1.haversine_bearing(p2).to_radians(); | |||
let crs_ad = p1.haversine_bearing(*from).unwrap().to_radians(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would change signature to return result
@@ -92,7 +92,7 @@ mod test { | |||
let pt2 = Point::new(-170.0, -30.0); | |||
|
|||
for (start, end) in [(pt1, pt2), (pt2, pt1)] { | |||
let bearing = start.haversine_bearing(end); | |||
let bearing = start.haversine_bearing(end).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would change signature to return result
Ok(()) | ||
} | ||
|
||
fn check_y_in_limits(&self) -> Result<(), String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Points can be projected - they might not be lat/lon.
CHANGES.md
if knowledge of this change could be valuable to users.I'm stuck in the comparison, I'm trying to implement the trait but I'm having issues. Any help would be appreciated.