22 #include <lal/LALStdlib.h>
23 #include <lal/LALConstants.h>
26 #include <lal/SkyCoordinates.h>
29 #define LAL_EARTHFLAT (0.00335281)
30 #define LAL_HSERIES (0.0001)
31 #define LAL_BSERIES (0.001)
370 if (
output->longitude < 0.0 )
404 if (
output->longitude < 0.0 )
421 REAL8 sina, sinA, cosA;
449 sina = sinD*sinP + cosD*cosP*cosH;
451 cosA = sinD*cosP - cosD*sinP*cosH;
455 output->latitude = asin( sina );
456 output->longitude = atan2( sinA, cosA );
459 if (
output->longitude < 0.0 )
476 REAL8 sinD, sinH, cosH;
503 sinD = sina*sinP + cosa*cosA*cosP;
505 cosH = sina*cosP - cosa*cosA*sinP;
509 output->latitude = asin( sinD );
513 if (
output->longitude < 0.0 )
545 c = sqrt( 1.0 / ( cosP*cosP + fFac*sinP*sinP ) );
564 r = sqrt(
x*
x +
y*
y + s*s );
593 x = rInv*location->
x;
594 y = rInv*location->
y;
595 z = rInv*location->
z;
596 pi = sqrt(
x*
x +
y*
y );
613 REAL8 za, e,
f,
p, p3,
q, q2, d, d2, b, v, w, g, h, gh, t, phi, tanP;
629 p = ( 4.0/3.0 )*( pi*pi + za*za - f2*f2 );
642 v = pow( d2 +
q, 1.0/3.0 )
643 + pow( -0.5*
q*h*( 1.0 - 0.25*h*( 1.0 - 0.5*h ) ), 1.0/3.0 );
645 v = pow( d2 +
q, 1.0/3.0 )
646 - pow( 0.5*
q*h*( 1.0 - 0.25*h*( 1.0 - 0.5*h ) ), 1.0/3.0 );
648 v = pow( d2, 1.0/3.0 )*( b*( 2.0/3.0 + b*b*10.0/81.0 ) );
649 }
else if ( b < 1.0 ) {
650 v = pow( d2, 1.0/3.0 )*( pow( 1.0 + b, 1.0/3.0 ) -
651 pow( 1.0 - b, 1.0/3.0 ) );
653 v = pow( d2, 1.0/3.0 )*( pow( b + 1.0, 1.0/3.0 ) +
654 pow( b - 1.0, 1.0/3.0 ) );
657 v = 2.0*sqrt( -
p )*cos( acos(
q/( -
p*sqrt( -
p ) ) )/3.0 );
662 w = fabs( e )*sqrt( 1.0 + h );
666 g = -0.25*e*h*( 1.0 - 0.25*h*( 1.0 - 0.5*h ) );
667 gh = fabs( pi*(
f*pi - v*g )/w );
670 t = g*( sqrt( 1.0 + h ) - 1.0 );
672 t = 0.5*g*h*( 1.0 - 0.25*h*( 1.0 - 0.5*h ) );
675 tanP = ( pi - t )*( pi + t )/( 2.0*f1*pi*t );
680 location->
elevation = ( pi - t/pi )*cos( phi );
681 location->
elevation += ( fabs( z ) - f1 )*sin( phi );
#define ABORT(statusptr, code, mesg)
#define ASSERT(assertion, statusptr, code, mesg)
#define INITSTATUS(statusptr)
#define RETURN(statusptr)
static double f(double theta, double y, double xi)
#define LAL_REARTH_SI
Earth equatorial radius, m.
#define LAL_TWOPI
2*pi is circumference of a circle divided by its radius
double REAL8
Double precision real floating-point number (8 bytes).
#define SKYCOORDINATESH_ENUL
Unexpected null pointer in arguments.
#define SKYCOORDINATESH_ESYS
Wrong coordinate system in input.
@ COORDINATESYSTEM_GEOGRAPHIC
The Earth-fixed geographic coordinate system.
@ COORDINATESYSTEM_HORIZON
A horizon coordinate system.
@ COORDINATESYSTEM_EQUATORIAL
The sky-fixed equatorial coordinate system.
void LALGeocentricToGeodetic(LALStatus *stat, EarthPosition *location)
void LALEquatorialToGeographic(LALStatus *stat, SkyPosition *output, SkyPosition *input, LIGOTimeGPS *gpsTime)
void LALHorizonToSystem(LALStatus *stat, SkyPosition *output, SkyPosition *input, const SkyPosition *zenith)
void LALGeographicToEquatorial(LALStatus *stat, SkyPosition *output, SkyPosition *input, LIGOTimeGPS *gpsTime)
void LALGeodeticToGeocentric(LALStatus *stat, EarthPosition *location)
void LALSystemToHorizon(LALStatus *stat, SkyPosition *output, SkyPosition *input, const SkyPosition *zenith)
REAL8 XLALGreenwichMeanSiderealTime(const LIGOTimeGPS *gpstime)
Convenience wrapper, calling XLALGreenwichSiderealTime() with the equation of equinoxes set to 0.
This structure stores the location of a point on (or near) the surface of the Earth in both geodetic ...
SkyPosition geocentric
The geographic coordinates of the direction from the centre of the Earth through the point; that is,...
REAL8 radius
The distance of the point from the geocentre, in metres.
REAL8 elevation
The vertical distance of the point above the reference ellipsoid, in metres.
REAL8 z
The Earth-fixed geocentric Cartesian coordinates of the point, in metres.
SkyPosition geodetic
The geographic coordinates of the upward vertical direction from the point; that is,...
LAL status structure, see The LALStatus structure for more details.
Epoch relative to GPS epoch, see LIGOTimeGPS type for more details.
This structure stores the two spherical coordinates of a sky position; ie a generic latitude and long...
REAL8 longitude
The longitudinal coordinate (in radians), as defined above.
REAL8 latitude
The latitudinal coordinate (in radians), as defined above.
CoordinateSystem system
The coordinate system in which latitude/longitude are expressed.
void output(int gps_sec, int output_type)