@@ -15,9 +15,10 @@ pub fn rhumb_dist(lat1: f64, long1: f64, lat2: f64, long2: f64) -> f64 {
1515 }
1616
1717 let del_psi = ( ( phi2 / 2.00 + PI / 4.00 ) . tan ( ) / ( phi1 / 2.00 + PI / 4.00 ) . tan ( ) ) . ln ( ) ;
18- let q = match del_psi. abs ( ) > 1e-12 {
19- true => del_phi / del_psi,
20- false => phi1. cos ( ) ,
18+ let q = if del_psi. abs ( ) > 1e-12 {
19+ del_phi / del_psi
20+ } else {
21+ phi1. cos ( )
2122 } ;
2223
2324 ( del_phi. powf ( 2.00 ) + ( q * del_lambda) . powf ( 2.00 ) ) . sqrt ( ) * EARTH_RADIUS
@@ -29,9 +30,9 @@ pub fn rhumb_bearing(lat1: f64, long1: f64, lat2: f64, long2: f64) -> f64 {
2930 let mut del_lambda = ( long2 - long1) * PI / 180.00 ;
3031
3132 if del_lambda > PI {
32- del_lambda -= 2.00 * PI ;
33+ del_lambda -= 2.0 * PI ;
3334 } else if del_lambda < -PI {
34- del_lambda += 2.00 * PI ;
35+ del_lambda += 2.0 * PI ;
3536 }
3637
3738 let del_psi = ( ( phi2 / 2.00 + PI / 4.00 ) . tan ( ) / ( phi1 / 2.00 + PI / 4.00 ) . tan ( ) ) . ln ( ) ;
@@ -48,9 +49,10 @@ pub fn rhumb_destination(lat: f64, long: f64, distance: f64, bearing: f64) -> (f
4849 let phi2 = ( phi1 + del_phi) . clamp ( -PI / 2.0 , PI / 2.0 ) ;
4950
5051 let del_psi = ( ( phi2 / 2.00 + PI / 4.00 ) . tan ( ) / ( phi1 / 2.0 + PI / 4.0 ) . tan ( ) ) . ln ( ) ;
51- let q = match del_psi. abs ( ) > 1e-12 {
52- true => del_phi / del_psi,
53- false => phi1. cos ( ) ,
52+ let q = if del_psi. abs ( ) > 1e-12 {
53+ del_phi / del_psi
54+ } else {
55+ phi1. cos ( )
5456 } ;
5557
5658 let del_lambda = del * theta. sin ( ) / q;
0 commit comments