@@ -23,45 +23,17 @@ namespace geodetics
2323 * @param lon2: the TO longitude in degrees decimal
2424 * @return heading_rad: the heading in radians in the NED frame
2525*/
26- double gpsHeading (double lat1, double lon1, double lat2, double lon2)
27- {
28- double lat1_rad = lat1 * M_PI / 180.0 ;
29- double lon1_rad = lon1 * M_PI / 180.0 ;
30- double lat2_rad = lat2 * M_PI / 180.0 ;
31- double lon2_rad = lon2 * M_PI / 180.0 ;
32-
33- double lon_diff = lon2_rad - lon1_rad;
34-
35- double y = std::sin (lon_diff) * std::cos (lat2_rad);
36- double x = std::cos (lat1_rad) * std::sin (lat2_rad) - std::sin (lat1_rad) * std::cos (lat2_rad) * std::cos (lon_diff);
37-
38- double heading_rad = std::atan2 (y,x);
39-
40- return heading_rad;
41- }
42-
26+ double gpsHeading (double lat1, double lon1, double lat2, double lon2);
4327/* ! @brief convert a heading in radians to degrees and normalize to [0,360)
4428 * @param heading: the heading in radians, can be ENU or NED frame
4529 * @return heading_deg: normalized heading in degrees in the same frame
4630 * that was input
4731*/
48- double headingRadiansToDegrees (double heading)
49- {
50- double heading_deg = heading * (180.0 / M_PI);
51-
52- heading_deg = std::fmod (std::fmod (heading_deg, 360.0 ) + 360.0 , 360.0 );
53- return heading_deg;
54- }
55-
32+ double headingRadiansToDegrees (double heading);
5633/* ! @brief convert a heading from the geodetic frame (NED) to the ENU frame
5734 * @param geodetic_heading: heading in radians in the geodetic (NED) frame
5835 * @return enu_heading: heading in radians in the ENU frame
5936*/
60- double geodeticToENU (double geodetic_heading)
61- {
62- double enu_heading = std::fmod ((M_PI/2 - geodetic_heading + (2 *M_PI)), (2 *M_PI));
63-
64- return enu_heading;
65- }
37+ double geodeticToENU (double geodetic_heading);
6638} // namespace geodetics
6739} // namespace glider
0 commit comments