Merge branch 'jmt/magvar'
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <simgear/magvar/magvar.hxx>
|
#include <simgear/magvar/magvar.hxx>
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
|
||||||
#include "coremag.hxx"
|
#include "coremag.hxx"
|
||||||
#include "magvar.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]));
|
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 ) {
|
double sgGetMagVar( double lon, double lat, double alt_m, double jd ) {
|
||||||
// cout << "lat = " << lat << " lon = " << lon << " elev = " << alt_m
|
// cout << "lat = " << lat << " lon = " << lon << " elev = " << alt_m
|
||||||
|
|||||||
@@ -33,6 +33,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// forward decls
|
||||||
|
class SGGeod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magnetic variation wrapper class.
|
* Magnetic variation wrapper class.
|
||||||
*
|
*
|
||||||
@@ -78,6 +81,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void update( double lon, double lat, double alt_m, double jd );
|
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. */
|
/** @return the current magnetic variation in radians. */
|
||||||
double get_magvar() const { return magvar; }
|
double get_magvar() const { return magvar; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user