Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

astro::EarthCoordinate Class Reference

describe a point with respect to the surface of the Earth. More...

#include <EarthCoordinate.h>

List of all members.

Public Methods

 EarthCoordinate (double latDeg, double lonDeg, double altitude=0)
 initialize with latitude and longitude, in deg, optional altitude. More...

 EarthCoordinate (Hep3Vector position, JulianDate jd)
 initialize with orbit position (in km), current date. More...

bool insideSAA () const
 true if inside the SAA. More...

double latitude () const
double longitude () const
double altitude () const

Static Public Methods

double earthRadius ()
 the Earth radius in km. More...


Static Private Methods

double GetGMST (JulianDate J_D)
 GetGMST returns the Greenwich sideral time in degrees, The mean is: GMST is the angular distance between the Vernal point and the Greenwich meridian. More...


Private Attributes

double m_lat
 internal representation: latitude and longitude in radians, altitude in km. More...

double m_lon
 internal representation: latitude and longitude in radians, altitude in km. More...

double m_altitude

Static Private Attributes

double s_EarthRadius = 6378145.


Detailed Description

describe a point with respect to the surface of the Earth.

Author:
T. Burnett and G. Tosti
Id:
EarthCoordinate.h,v 1.2 2002/08/14 14:37:30 burnett Exp

Note that we calculate the geodetic coordinates: from http://ssd.jpl.nasa.gov/glossary.html#geodetic

Geodetic coordinates, latitude and longitude, specify a location on the Earth's oblate (non-spherical) surface. Latitude, unless otherwise specified, is generally the geodetic latitude. Geodetic latitude is defined as the angle between the equatorial plane and a line normal to the surface at that location. Geodetic longitude is the angular distance between the location's meridian and the Greenwich meridian.

Definition at line 24 of file EarthCoordinate.h.


Constructor & Destructor Documentation

astro::EarthCoordinate::EarthCoordinate double    latDeg,
double    lonDeg,
double    alt = 0
 

initialize with latitude and longitude, in deg, optional altitude.

Definition at line 39 of file EarthCoordinate.cxx.

00040 : m_lat(latDeg*M_PI/180), m_lon(lonDeg*M_PI/180), m_altitude(alt)
00041 {}

astro::EarthCoordinate::EarthCoordinate Hep3Vector    pos,
JulianDate    jd
 

initialize with orbit position (in km), current date.

Definition at line 20 of file EarthCoordinate.cxx.

00021 {
00022     m_lat = M_PI/2- pos.theta();
00023     double GMST0 = GetGMST(jd);
00024     m_lon = GetGMST(jd)*M_PI/180 - pos.phi();
00025     m_lon = fmod(m_lon, 2*M_PI); if(m_lon>M_PI) m_lon -= 2*M_PI;
00026 
00027     // oblateness correction to obtain geodedic latitude 
00028     m_lat=(atan(tan(m_lat))/(sqr(1.-EarthFlat)) );
00029 
00030     // this is also such a correction: the number 0.00669454 is the geodetic eccentricity squared?
00031     // see http://www.cage.curtin.edu.au/~will/gra64_05.pdf
00032     // or http://www.colorado.edu/geography/gcraft/notes/datum/gif/ellipse.gif
00033     m_altitude=sqrt(sqr(pos.x())+sqr(pos.y())/cos(m_lat) )
00034         -s_EarthRadius / (1000.*sqrt(1.-sqr(0.00669454*sin(m_lat))));
00035 
00036 }


Member Function Documentation

double astro::EarthCoordinate::GetGMST JulianDate    jd [static, private]
 

GetGMST returns the Greenwich sideral time in degrees, The mean is: GMST is the angular distance between the Vernal point and the Greenwich meridian.

Definition at line 44 of file EarthCoordinate.cxx.

Referenced by EarthCoordinate().

00045 {
00046     double J_D=jd;
00047     double M, Ora_Un_Dec=modf(J_D-0.5,&M)*24;  J_D-=Ora_Un_Dec/24;
00048     double T = (J_D - J2000) / 36525.;
00049     double T1 = (24110.54841 + 8640184.812866 * T + 0.0093103 * T * T)/86400.0;
00050     double Tempo_Siderale_0 = modf(T1,&M) * 24.;
00051     double Tempo_Siderale_Ora = Tempo_Siderale_0 + Ora_Un_Dec * 1.00273790935;
00052     if (Tempo_Siderale_Ora < 0.) Tempo_Siderale_Ora = Tempo_Siderale_Ora + 24.;
00053     if (Tempo_Siderale_Ora >= 24.) Tempo_Siderale_Ora = Tempo_Siderale_Ora - 24.;
00054     return Tempo_Siderale_Ora*15.;  
00055 }  

double astro::EarthCoordinate::altitude   const [inline]
 

Definition at line 63 of file EarthCoordinate.h.

Referenced by main().

00063 { return m_altitude;}

double astro::EarthCoordinate::earthRadius   [static]
 

the Earth radius in km.

bool astro::EarthCoordinate::insideSAA   const
 

true if inside the SAA.

Definition at line 57 of file EarthCoordinate.cxx.

00058 {
00059     double perim[7][2] = {{-88.,-30.},{-88.,-12.},{-55.,-0.1},{-32.,-0.1},{-7,-12},
00060     {50.,-25},{50.,-30.}};
00061     double longmin=-88;
00062     double longmax=50.;
00063     double latmin=-30;
00064     double latmax=-0.1;
00065     double diffx[7],diffy[7],diffd[7];
00066     double lon=longitude(), lat=latitude();
00067     if((lon>=longmin)&&(lon<=longmax)&&(lat>=latmin)&&(lat<=latmax)){
00068         for (int i=0;i<6;i++){
00069             diffx[i]=perim[i+1][0]-perim[i][0];
00070             diffy[i]=perim[i+1][1]-perim[i][1];
00071             //cout<<i<<"  "<<diffx[i]<<endl;
00072         }
00073         diffx[6]=perim[0][0]-perim[6][0];
00074         diffy[6]=perim[0][1]-perim[6][1];
00075         
00076         for (i=0;i<7;i++){
00077             diffd[i]=sqrt(sqr(diffx[i])+sqr(diffy[i]));
00078         }
00079         double xnew[7],ynew[7];
00080         int inside[7];
00081         int xtemp[7],txtemp=0,tins=0;
00082         for (i=0;i<7;i++){
00083             xnew[i]=((lon-perim[i][0])*diffx[i]+(lat-perim[i][1])*diffy[i])/diffd[i];
00084             ynew[i]=(lat-perim[i][1])*diffx[i]-(lon-perim[i][0])*diffy[i];
00085             xtemp[i]=((xnew[i] >=0.)&&(xnew[i]<=diffd[i]));
00086             inside[i]=(xtemp[i] == 1) && (ynew[i]<0.);
00087             txtemp+=xtemp[i];
00088             tins+=inside[i];
00089             //cout<<diffd[i]<<endl;
00090         }
00091         bool insaa=(txtemp==tins)&&(txtemp >0);
00092         
00093         return insaa;
00094     }
00095     else
00096         return false;
00097 }

double astro::EarthCoordinate::latitude   const [inline]
 

Definition at line 61 of file EarthCoordinate.h.

Referenced by main().

00061 { return m_lat*180/M_PI;}

double astro::EarthCoordinate::longitude   const [inline]
 

Definition at line 62 of file EarthCoordinate.h.

Referenced by main().

00062 { return m_lon*180/M_PI;}


Member Data Documentation

double astro::EarthCoordinate::m_altitude [private]
 

Definition at line 49 of file EarthCoordinate.h.

double astro::EarthCoordinate::m_lat [private]
 

internal representation: latitude and longitude in radians, altitude in km.

Definition at line 48 of file EarthCoordinate.h.

double astro::EarthCoordinate::m_lon [private]
 

internal representation: latitude and longitude in radians, altitude in km.

Definition at line 48 of file EarthCoordinate.h.

double astro::EarthCoordinate::s_EarthRadius = 6378145. [static, private]
 

Definition at line 16 of file EarthCoordinate.cxx.


The documentation for this class was generated from the following files:
Generated on Wed Aug 14 10:09:36 2002 for astro by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001