Overload the SGMagVar::update method to take an SGGeod.
This commit is contained in:
parent
ff95af0367
commit
5da3d64ede
@ -24,6 +24,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <simgear/magvar/magvar.hxx>
|
||||
#include <simgear/math/SGMath.hxx>
|
||||
|
||||
#include "coremag.hxx"
|
||||
#include "magvar.hxx"
|
||||
@ -47,6 +48,12 @@ void SGMagVar::update( double lon, double lat, double alt_m, double jd ) {
|
||||
magdip = atan(field[5]/sqrt(field[3]*field[3]+field[4]*field[4]));
|
||||
}
|
||||
|
||||
void SGMagVar::update( const SGGeod& geod, double jd ) {
|
||||
|
||||
update(geod.getLongitudeDeg(), geod.getLatitudeDeg(),
|
||||
geod.getElevationM(), jd);
|
||||
}
|
||||
|
||||
|
||||
double sgGetMagVar( double lon, double lat, double alt_m, double jd ) {
|
||||
// cout << "lat = " << lat << " lon = " << lon << " elev = " << alt_m
|
||||
|
@ -33,6 +33,9 @@
|
||||
#endif
|
||||
|
||||
|
||||
// forward decls
|
||||
class SGGeod;
|
||||
|
||||
/**
|
||||
* Magnetic variation wrapper class.
|
||||
*
|
||||
@ -78,6 +81,11 @@ public:
|
||||
*/
|
||||
void update( double lon, double lat, double alt_m, double jd );
|
||||
|
||||
/**
|
||||
* overloaded variant taking an SGGeod to specify position
|
||||
*/
|
||||
void update( const SGGeod& geod, double jd );
|
||||
|
||||
/** @return the current magnetic variation in radians. */
|
||||
double get_magvar() const { return magvar; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user