Astro-PAL

 view release on metacpan or  search on metacpan

palsrc/palOne2One.c  view on Meta::CPAN

*     2012-02-10 (TIMJ):
*        Initial version
*        Adapted with permission from the Fortran SLALIB library.
*     2012-03-23 (TIMJ):
*        Update prologue.
*     2012-05-09 (DSBJ):
*        Move palDrange into a separate file.
*     2014-07-15 (TIMJ):
*        SOFA now has palRefcoq equivalent.
*     {enter_further_changes_here}

*  Copyright:
*     Copyright (C) 2014 Tim Jenness
*     Copyright (C) 2012 Science and Technology Facilities Council.
*     All Rights Reserved.

*  Licence:
*     This program is free software: you can redistribute it and/or
*     modify it under the terms of the GNU Lesser General Public
*     License as published by the Free Software Foundation, either
*     version 3 of the License, or (at your option) any later
*     version.
*
*     This program is distributed in the hope that it will be useful,
*     but WITHOUT ANY WARRANTY; without even the implied warranty of
*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*     GNU Lesser General Public License for more details.
*
*     You should have received a copy of the GNU Lesser General
*     License along with this program.  If not, see
*     <http://www.gnu.org/licenses/>.

*  Bugs:
*     {note_any_bugs_here}
*-
*/

#include "pal.h"
#include "palmac.h"
#include "pal1sofa.h"

/*
*+
*  Name:
*     palCldj

*  Purpose:
*     Gregorian Calendar to Modified Julian Date

*  Language:
*     Starlink ANSI C

*  Type of Module:
*     Library routine

*  Invocation:
*     palCldj( int iy, int im, int id, double *djm, int *j );

*  Arguments:
*     iy = int (Given)
*        Year in Gregorian calendar
*     im = int (Given)
*        Month in Gregorian calendar
*     id = int (Given)
*        Day in Gregorian calendar
*     djm = double * (Returned)
*        Modified Julian Date (JD-2400000.5) for 0 hrs
*     j = int * (Returned)
*        status: 0 = OK, 1 = bad year (MJD not computed),
*        2 = bad month (MJD not computed), 3 = bad day (MJD computed).

*  Description:
*     Gregorian calendar to Modified Julian Date.

*  Notes:
*     - Uses eraCal2jd(). See SOFA/ERFA documentation for details.

*-
*/

void palCldj ( int iy, int im, int id, double *djm, int *j ) {
  double djm0;
  *j = eraCal2jd( iy, im, id, &djm0, djm );
}

/*
*+
*  Name:
*     palDbear

*  Purpose:
*     Bearing (position angle) of one point on a sphere relative to another

*  Language:
*     Starlink ANSI C

*  Type of Module:
*     Library routine

*  Invocation:
*     pa = palDbear( double a1, double b1, double a2, double b2 );

*  Arguments:
*     a1 = double (Given)
*        Longitude of point 1 (e.g. RA) in radians.
*     b1 = double (Given)
*        Latitude of point 1 (e.g. Dec) in radians.
*     a2 = double (Given)
*        Longitude of point 2 in radians.
*     b2 = double (Given)
*        Latitude of point 2 in radians.

*  Returned Value:
*     The result is the bearing (position angle), in radians, of point
*     A2,B2 as seen from point A1,B1.  It is in the range +/- pi.  If
*     A2,B2 is due east of A1,B1 the bearing is +pi/2.  Zero is returned
*     if the two points are coincident.

*  Description:
*     Bearing (position angle) of one point in a sphere relative to another.

*  Notes:
*     - Uses eraPas(). See SOFA/ERFA documentation for details.

*-
*/

double palDbear ( double a1, double b1, double a2, double b2 ) {
  return eraPas( a1, b1, a2, b2 );
}

/*
*+



( run in 1.367 second using v1.01-cache-2.11-cpan-5837b0d9d2c )