package nxm.sys.inc;

/** Definitions of useful scientific constants. This includes:
    <ol>
      <li>Binary Exponents</li>
      <li>Mathematically interesting constants</li>
      <li>Radial conversion factors</li>
      <li>Distance conversion factors (nm = nautical miles,
                                       sm = statute miles)</li>
      <li>Constants associated with System Simulator package</li>
    </ol>
    <br>

    <a id="WGS84">
      <b>Note:</b> Values marked with "(Source WGS 84)" were referenced from:<br>

        United States. National Imagery and Mapping Agency.<br>
        <i>Department of Defense World Geodetic System 1984</i><br>
        NIMA TR8350.2 Third Edition. Amendment 1. 3 January 2000.<br>


        (See &lt;<a href="http://earth-info.nga.mil/GandG/publications/tr8350.2/tr8350_2.html">
                          http://earth-info.nga.mil/GandG/publications/tr8350.2/tr8350_2.html</a>
        &gt;)
    </a><br>

   @author Jeff Schoen
 */
public interface Constants {
  /** Binary variant of a Tera. Note that this differs from the typical version
      (the decimal) version of Tera which is 10<sup>12</sup>.<br>
      <br>
      Value: <code>{@value} = 1T = 2<sup>40</sup></code><br>
   */
  long B1T  = 1099511627776L;

  /** Binary variant of a Giga. Note that this differs from the typical version
      (the decimal) version of Giga which is 10<sup>9</sup>.<br>
      <br>
      Value: <code>{@value} = 1G = 2<sup>30</sup></code><br>
   */
  int B1G  = 1073741824;

  /** Binary variant of a Mega. Note that this differs from the typical version
      (the decimal) version of Mega which is 10<sup>6</sup>.<br>
      <br>
      Value: <code>{@value} = 1M = 2<sup>20</sup></code><br>
   */
  int B1M  = 1048576;

  /** This is the binary version of <code>64K</code>. <br>
      <br>
      Value: <code>{@value} = 64 * {@link #B1K}</code><br>

      @see #B1K
   */
  int B64K = 65536;

  /** Binary variant of a Kilo. Note that this differs from the typical version
      (the decimal) version of Kilo which is 10<sup>3</sup>.<br>
      <br>
      Value: <code>{@value} = 1K = 2<sup>10</sup></code><br>
   */
  int B1K  = 1024;

  /** This is the base of the natural logarithm <i>e</i>. <br>
      <br>
      Value: <code>{@value} = <i>e</i><sup>1</sup></code><br>

      @see java.lang.Math#E
   */
  double E = 2.718281828459045;

  /** This is the ratio of the circumference to the diameter of a circle. <br>
      <br>
      Value: <code>{@value} = &pi;</code><br>
      This constant value goes to 24 decimal places, while java.lang.Math#PI
      only goes to 20 decimal places.

      @see java.lang.Math#PI
      @see #HALFPI
      @see #TWOPI
   */
  double PI = 3.141592653589793238462643;

  /** This is half the ratio of the circumference to the diameter of a circle.
      <br>
      <br>
      Value: <code>{@value} = &pi; / 2</code><br>

      @see #PI
      @see #TWOPI
   */
  double HALFPI = 1.570796326794896619231322;

  /** This is twice the ratio of the circumference to the diameter of a circle.
      <br>
      <br>
      Value: <code>{@value} = 2 &pi;</code><br>

      @see #PI
   */
  double TWOPI = 6.283185307179586476925287;

  /** The natural logarithm <i>(base e)</i> of ten. <br>
      <br>
      Value: <code>{@value} = LN(10)</code><br>

      @see #LN2LOG
      @see #LN2DB
   */
  double LNTEN = 2.302585092994045679049005;

  /** The multiplicative inverse of the natural logarithm <i>(base e)</i> of ten. <br>
      Use to convert from LN <i>(base e)</i> to LOG <i>(base 10)</i> by multiplying this constant value.
      <br>
      Value: <code>{@value} = 1 / {@link #LNTEN}</code><br>

      @see #LN2LOG
      @see #LN2DB
   */
  double LN2LOG = 0.43429448190325;

  /** The multiplicative inverse of the natural logarithm <i>(base e)</i> of ten multiplied by ten. <br>
      Use to convert from LN <i>(base e)</i> to dB = 10 LOG <i>(base 10)</i> by multiplying this constant value.
      <br>
      Value: <code>{@value} = 10 / {@link #LNTEN}</code><br>

      @see #LN2LOG
      @see #LN2DB
   */
  double LN2DB = 4.3429448190325;

  /** This is the number of degrees (deg) of an arc in one radian (rad). <br>
      <br>
      Value: <code>{@value} deg/rad</code><br>

      @see #DEG2RAD
   */
  double RAD2DEG = 57.295779513082320876798155;


  /** This is the number of radians (rad) of an arc in one degree (deg). <br>
      <br>
      Value: <code>{@value} rad/deg = 1 / {@link #RAD2DEG}</code><br>

      @see #RAD2DEG
   */
  double DEG2RAD = 1/RAD2DEG;

  /** This is the fraction of a cycle (cycle) contained in one radian (rad).
      <br>
      <br>
      Value: <code>{@value} cycle/rad = 1 / {@link #TWOPI}</code><br>

      @see #CYC2RAD
   */
  double RAD2CYC = 1/TWOPI;

  /** This is the number of radians (rad) in one full cycle (cycle). <br>
      <br>
      Value: <code>{@value} rad/cycle = {@link #TWOPI}</code><br>

      @see #RAD2CYC
   */
  double CYC2RAD = TWOPI;

  /** The number of meters in one foot. <br>
      <br>
      Value: <code>{@value} m/ft</code><br>

      @see #METERS2FEET
   */
  double FEET2METERS = 0.3048;

  /** The number of feet in one meter. <br>
      <br>
      Value: <code>{@value} ft/m</code> = 1 / {@link #FEET2METERS}<br>

      @see #FEET2METERS
   */
  double METERS2FEET = 1/FEET2METERS;


  /** The number of meters in one nautical mile (nmi). <br>
      <br>
      Value: <code>{@value} m/nmi</code><br>

      @see #METERS2NM
      @see #SM2METERS
      @see #METERS2SM
   */
  double NM2METERS = 1852.0;

  /** The number of nautical miles (nmi) in one meter. <br>
      <br>
      Value: <code>{@value} nmi/m = 1 / {@link #NM2METERS}</code><br>

      @see #NM2METERS
      @see #SM2METERS
      @see #METERS2SM
   */
  double METERS2NM = 1/NM2METERS;

  /** The number of meters in one statute mile (mi). <br>
      <br>
      Value: <code>{@value} m/mi</code><br>

      @see #NM2METERS
      @see #METERS2NM
      @see #METERS2SM
   */
  double SM2METERS = 1609.344;

  /** The number of statute miles (mi) in one meter. <br>
      <br>
      Value: <code>{@value} mi/m = 1 / {@link #SM2METERS}</code><br>

      @see #NM2METERS
      @see #SM2METERS
      @see #METERS2NM
   */
  double METERS2SM = 1/SM2METERS;

  /** The number of feet in one nautical mile (nmi). <br>
      <br>
      Value: <code>{@value} ft/nmi</code><br>

      @see #SM2FEET
   */
  double NM2FEET = 6076.11548556;

  /** The number of feet in one statute mile (mi). <br>
      <br>
      Value: <code>{@value} mi/ft</code><br>

      @see #NM2FEET
   */
  double SM2FEET = 5280.0;


  /** The eccentricity of the Earth. <br>
      <br>
      Value: <code>{@value} = e</code><br>
      <br>
      <span style="color:red">This value represents the value as published in the
         third edition of WGS&nbsp;84. NeXtMidas&nbsp;1.7.3 uses a less-precise
         value for this constant (<code>8.18191908426E-2</code>).</span><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)
   */
  double EARTH_ECCENTRICITY = 8.1819190842622E-2;

  /** The second eccentricity of the Earth<br>
      <br>Value: <code>{@value} = e'</code>
      <br>(Source <a href="#WGS84">WGS 84</a>)
      @since NeXtMidas 2.5.0
   */
  double SECOND_EARTH_ECCENTRICITY = 8.2094437949696E-2;

  /** The equatorial radius of the Earth in meters. <i>This is also called the
      semi-major axis of the Earth.</i><br>
      <br>
      Value: <code>{@value} meters = a</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #POLAR_RADIUS_IN_METERS
   */
  double EARTH_EQUATORIAL_RADIUS = 6378137.0;

  /** Factor for computing the angular velocity of the Earth in a precessing
      reference frame. <br>
      <br>
      From pages 3-5 and 3-6 in the third edition of
      <a href="#WGS84">WGS&nbsp;84</a>:
      <pre>
        &omega;* = Angular Velocity of the Earth in a precessing
             reference frame.

        &omega;* = 7292115.8553E-11 + 4.3E-15 Tu rad/sec

        Tu = Julian Centuries from Epoch J2000.0
      </pre>
      Thus:
      <pre>
        &omega;* = ({@link #EARTH_ANGULAR_VELOCITY}
               + {@link #ANGULAR_VELOCITY_PRECESSING_COR} Tu) rad/sec
      </pre>
      <br>
      Value: <code>{@value} rad/sec</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #DEF_EARTH_ANGULAR_VELOCITY
      @see #IAU_EARTH_ANGULAR_VELOCITY
      @see #ANGULAR_VELOCITY_PRECESSING_COR
   */
  double EARTH_ANGULAR_VELOCITY = 7292115.8553E-11;

  /** The correction factor for processing angular velocity. This factor is used
      when obtaining the angular velocity of the Earth in a precessing
      reference frame (&omega;*).<br>
      <br>
      <i>See {@link #EARTH_ANGULAR_VELOCITY} for details on the use of this
      constant.</i><br>
      <br>
      Value: <code>{@value} (rad/sec)/(Julian Centuries from Epoch J2000.0)
             </code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_ANGULAR_VELOCITY
   */
  double ANGULAR_VELOCITY_PRECESSING_COR = 4.3E-15;

  /** The <i>default</i> angular velocity of the Earth as specified in
      WGS&nbsp;84 and GRS&nbsp;80.
      <br>
      <br>
      Value: <code>{@value} rad/sec = &omega;</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_ANGULAR_VELOCITY
      @see #IAU_EARTH_ANGULAR_VELOCITY
   */
  double DEF_EARTH_ANGULAR_VELOCITY = 7292115E-11;

  /** The <i>IAU</i> angular velocity of the Earth as specified in GRS&nbsp;67.
      <br>
      <br>
      Value: <code>{@value} rad/sec = &omega;'</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_ANGULAR_VELOCITY
      @see #DEF_EARTH_ANGULAR_VELOCITY
   */
  double IAU_EARTH_ANGULAR_VELOCITY = 7292115.1467E-11;

  /** The "flattening factor" of the Earth. <br>
      <br>
      Value: <code>{@value} = f</code><br>
      <br>
      <span style="color:red">This is a computed value since only <code>1/f</code> is
      specified in WGS&nbsp;84.</span> The computation is based on the following
      expression:
      <pre>
        f = 1/(1/f) = 1/(298.257223563)
      </pre>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)
   */
  @InternalUseOnly
  public double EARTH_FLATTENING_FACTOR = 0.00335281066474;


  /** The polar radius of the Earth in meters. <i>This is also called the
      semi-minor axis of the Earth.</i><br>
      <br>
      Value: <code>{@value} meters = b</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_EQUATORIAL_RADIUS
   */
  double POLAR_RADIUS_IN_METERS = 6356752.3142;

  /** The polar radius of curvature for the Earth. <br>
      <br>
      Value: <code>{@value} = c</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_EQUATORIAL_RADIUS
   */
  double POLAR_RADIUS_OF_CURVATURE = 6399593.6258;

  /** The mass of the Earth with atmosphere. <br>
      <br>
      Value: <code>{@value} kg = M</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)
   */
  double MASS_OF_EARTH_W_ATMOS = 5.9733328E+24;

  /** The <i>revised</i> gravitational constant for the Earth with atmosphere.
      <br>
      <br>
      Value: <code>{@value} m<sup>3</sup>/s<sup>2</sup> = GM</code><br>
      <br>
      This value has a 1&sigma; uncertainty of:
      <code>&plusmn;0.000000008E14 m<sup>3</sup>/s<sup>2</sup></code><br>
      <br>
      <span style="color:red">
        This value represents the revised WGS&nbsp;84 value.
        NeXtMidas&nbsp;1.7.3 uses the original WGS&nbsp;84
        value for this constant. The original WGS&nbsp;84
        value for this constant is available as
        {@link #EARTH_GRAV_CONSTANT_W_ATMOS_ORIG}.<br>
      </span>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_GRAV_CONSTANT_W_ATMOS_ORIG
      @see #EARTH_GRAV_CONSTANT_WO_ATMOS
      @see #EARTH_GRAV_CONSTANT_WO_ATMOS_ORIG
   */
  double EARTH_GRAV_CONSTANT_W_ATMOS = 3986004.418e8;

  /** The <i>old</i> gravitational constant for the Earth with atmosphere. <br>
      <br>
      This value represents the original WGS&nbsp;84 value for the Earth's
      gravitational constant with atmosphere. The revised value is now available
      as {@link #EARTH_GRAV_CONSTANT_W_ATMOS}. Please consult the third
      edition of <a href="#WGS84">WGS&nbsp;84</a> for details on when this
      value should be used rather than the revised one.<br>
      <br>
      Value: <code>{@value} m<sup>3</sup>/s<sup>2</sup> = GM</code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_GRAV_CONSTANT_W_ATMOS
      @see #EARTH_GRAV_CONSTANT_WO_ATMOS
      @see #EARTH_GRAV_CONSTANT_WO_ATMOS_ORIG

      @since NeXtMidas 1.8.0
   */
  double EARTH_GRAV_CONSTANT_W_ATMOS_ORIG = 3986005.0e8;

  /** The <i>revised</i> gravitational constant for the Earth without
      atmosphere. <br>
      <br>
      Value: <code>{@value} m<sup>3</sup>/s<sup>2</sup> = GM'</code><br>
      <br>
      This value has a 1&sigma; uncertainty of:
      <code>&plusmn;0.0000001E14 m<sup>3</sup>/s<sup>2</sup></code><br>
      <br>
      <span style="color:red">
        This value represents the revised WGS&nbsp;84 value.
        NeXtMidas&nbsp;1.7.3 uses the original WGS&nbsp;84
        value for this constant. The original WGS&nbsp;84
        value for this constant is available as
        {@link #EARTH_GRAV_CONSTANT_WO_ATMOS_ORIG}.<br>
      </span>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_GRAV_CONSTANT_W_ATMOS
      @see #EARTH_GRAV_CONSTANT_W_ATMOS_ORIG
      @see #EARTH_GRAV_CONSTANT_WO_ATMOS_ORIG
   */
  double EARTH_GRAV_CONSTANT_WO_ATMOS = 3986000.9E+8;

  /** The <i>old</i> gravitational constant for the Earth without atmosphere.
      <br>
      <br>
      Value: <code>{@value} m<sup>3</sup>/s<sup>2</sup> = GM'</code><br>
      <br>
      This value represents the original WGS&nbsp;84 value for the Earth's
      gravitational constant without atmosphere. The revised value is now
      available as {@link #EARTH_GRAV_CONSTANT_WO_ATMOS}.<br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)

      @see #EARTH_GRAV_CONSTANT_W_ATMOS
      @see #EARTH_GRAV_CONSTANT_W_ATMOS_ORIG
      @see #EARTH_GRAV_CONSTANT_WO_ATMOS

      @since NeXtMidas 1.8.0
   */
  double EARTH_GRAV_CONSTANT_WO_ATMOS_ORIG = 3.9860015E14;

  /** The speed of light in a vacuum in meters per second. <br>
      <br>
      Value: <code>{@value} m/sec = <i>c</i></code><br>
      <br>
      (Source <a href="#WGS84">WGS 84</a>)
   */
  double SPEED_OF_LIGHT = 299792458;

  /** For conversion from meters to degrees and back for a spheric (geocentric) Earth model. <b>Note
      that this is an rough approximation since the actual values for converting between degrees
      and meters differ between latitude and longitude in a manner that is dependent on the latitude
      of the observer.</b><br>
      <br>
      Value: <code>{@value} deg/m = 180 / ({@link #EARTH_EQUATORIAL_RADIUS} * {@link #PI})</code><br>
      @since NeXtMidas 2.7.0
   */
  double METERS2DEG = 180 / (EARTH_EQUATORIAL_RADIUS * PI);

  /** For conversion from degrees to meters and back for a spheric (geocentric) Earth model. <b>Note
      that this is an rough approximation since the actual values for converting between degrees
      and meters differ between latitude and longitude in a manner that is dependent on the latitude
      of the observer.</b><br>
      <br>
      Value: <code>{@value} m/deg = 1 / {@link #METERS2DEG}</code><br>
      @since NeXtMidas 2.7.0
   */
  double DEG2METERS = 1 / METERS2DEG;

}