VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
makVrv::DtWorldMagneticModel Class Reference

Contains the interface to the world magnetic model. The class utilizes the WMM c code provided by NOAA which has been wrapped into makWMM.

This class is initialized using a coefficients file called WMM.COF which resides in the bin(platform) folder. Note that the parameters are good until the year 2025. The parameters have a 5 year epoch that deteriorates over the 5 year period (2020 - 2024). The WMM.COF file will need to be updated after the epoch ends. see this link for more information: https://www.ngdc.noaa.gov/geomag/WMM/limit.shtml

The basic use of this class is to compute the magnetic north declination at any given location on the globe. See the positionToMagneticNorth method.

This class is also used by VRF sim.

Inheritance diagram for makVrv::DtWorldMagneticModel:
Inheritance graph
[legend]

Public Member Functions

 DtWorldMagneticModel ()
 
virtual ~DtWorldMagneticModel ()
 
 DtWorldMagneticModel (const DtWorldMagneticModel &other)
 
DtWorldMagneticModel & operator= (const DtWorldMagneticModel &other)=delete
 
DtWorldMagneticModel * clone () const
 
virtual bool init (const time_t unixTime)
 
virtual bool badInit () const
 
virtual void setTime (const time_t unixTime)
 
virtual const time_t unixTime () const
 
virtual double positionToMagneticNorth (const DtGeodeticCoord &pos) const
 
virtual double trueToMagneticHeading (const DtVector &geocentricPos, double trueHeadingRad) const
 
virtual double magneticToTrueHeading (const DtVector &geocentricPos, double magneticHeadingRad) const
 
virtual double getMagneticNorth (const DtGeodeticCoord &geodeticPos)
 

Protected Member Functions

virtual bool computeYearMonthDay (const time_t unixTime, int &year, int &month, int &day) const
 

Protected Attributes

MAGtype_MagneticModel * myMagneticModels [1]
 
MAGtype_MagneticModel * myTimedMagneticModel
 
MAGtype_Ellipsoid myEllip
 
MAGtype_Geoid myGeoid
 
MAGtype_Date myDate
 
time_t myUnixTime
 
bool myBadInit
 

Constructor & Destructor Documentation

makVrv::DtWorldMagneticModel::DtWorldMagneticModel ( )

Constructor note: Must call init() to use the object.

virtual makVrv::DtWorldMagneticModel::~DtWorldMagneticModel ( )
virtual

Destructor.

makVrv::DtWorldMagneticModel::DtWorldMagneticModel ( const DtWorldMagneticModel &  other)

Copy Constructor.

Member Function Documentation

DtWorldMagneticModel& makVrv::DtWorldMagneticModel::operator= ( const DtWorldMagneticModel &  other)
delete

Assignment Operator not implemented - Assignment not allowed.

DtWorldMagneticModel* makVrv::DtWorldMagneticModel::clone ( ) const

Create a copy of the world magnetic model.

virtual bool makVrv::DtWorldMagneticModel::init ( const time_t  unixTime)
virtual

Initialize the WMM model using the "WMM.COF" located in the bin(platform) folder. This is required to be called before using the object. This returns true if the initialization is successful; false otherwise.

virtual bool makVrv::DtWorldMagneticModel::badInit ( ) const
virtual

Returns true if initialization was unsucessful.

virtual void makVrv::DtWorldMagneticModel::setTime ( const time_t  unixTime)
virtual

Sets the current time used for the WMM model. This will update the model time.

virtual const time_t makVrv::DtWorldMagneticModel::unixTime ( ) const
virtual

Returns the time used for the WMM model.

virtual double makVrv::DtWorldMagneticModel::positionToMagneticNorth ( const DtGeodeticCoord &  pos) const
virtual

Computes magnetic north declination at the given radian geodetic coordinates. Returns declination in radians. declination is the angle between true north and magnetic north, positive east rotation.

Parameters
posThe location radian geodetic coordinates.
virtual double makVrv::DtWorldMagneticModel::trueToMagneticHeading ( const DtVector &  geocentricPos,
double  trueHeadingRad 
) const
virtual

Computes the magnetic heading given a true heading and geocentric position. Returns the magnetic heading in radians. magnetic heading is the angle between magnetic north.

Parameters
geocentricPos,:entity geocentric position (DtVector)
trueHeadingRadheading relative to true north (radians)
virtual double makVrv::DtWorldMagneticModel::magneticToTrueHeading ( const DtVector &  geocentricPos,
double  magneticHeadingRad 
) const
virtual

Computes the true heading given a magnetic heading and geocentric position. Returns the true heading in radians. magnetic heading is the angle between magnetic north.

Parameters
geocentricPos,:entity geocentric position (DtVector)
magneticHeadingRadheading relative to magnetic north (radians)
virtual double makVrv::DtWorldMagneticModel::getMagneticNorth ( const DtGeodeticCoord &  geodeticPos)
virtual

input in radian geodetic coordinates. returns declination in radians Returns declination in radians. declination is the angle between true north

Parameters
geodeticPosThe location radian geodetic coordinates.
virtual bool makVrv::DtWorldMagneticModel::computeYearMonthDay ( const time_t  unixTime,
int &  year,
int &  month,
int &  day 
) const
protectedvirtual

Computes the (year, month, day) from the given time. Returns true on success.

Parameters
unixTimeThe input time.
yearThe computed output year.
monthThe computed output month (1 - 12); 1 = january.
dayThe computed output day or the month (1 - 31).

Member Data Documentation

MAGtype_MagneticModel* makVrv::DtWorldMagneticModel::myMagneticModels[1]
protected
MAGtype_MagneticModel* makVrv::DtWorldMagneticModel::myTimedMagneticModel
protected
MAGtype_Ellipsoid makVrv::DtWorldMagneticModel::myEllip
protected
MAGtype_Geoid makVrv::DtWorldMagneticModel::myGeoid
protected
MAGtype_Date makVrv::DtWorldMagneticModel::myDate
protected
time_t makVrv::DtWorldMagneticModel::myUnixTime
protected
bool makVrv::DtWorldMagneticModel::myBadInit
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)