Astro-PAL
view release on metacpan or search on metacpan
palsrc/palOapqk.c view on Meta::CPAN
* axes, and finally for the tilt of the azimuth or polar axis
* of the mounting (with appropriate corrections for mount
* flexures). Some telescopes would, of course, exhibit other
* properties which would need to be accounted for at the
* appropriate point in the sequence.
*
* - The star-independent apparent-to-observed-place parameters
* in AOPRMS may be computed by means of the palAoppa routine.
* If nothing has changed significantly except the time, the
* palAoppat routine may be used to perform the requisite
* partial recomputation of AOPRMS.
*
* - The azimuths etc used by the present routine are with respect
* to the celestial pole. Corrections from the terrestrial pole
* can be computed using palPolmo.
* History:
* 2012-08-27 (TIMJ):
* Initial version, direct copy of Fortran SLA
* Adapted with permission from the Fortran SLALIB library.
* {enter_further_changes_here}
* Copyright:
* Copyright (C) 2004 Patrick T. Wallace
* 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 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
* Bugs:
* {note_any_bugs_here}
*-
*/
#include <math.h>
#include "pal.h"
#include "palmac.h"
void palOapqk ( const char *type, double ob1, double ob2, const double aoprms[14],
double *rap, double *dap ) {
/* breakpoint for fast/slow refraction algorithm:
* zd greater than arctan(4), (see palRefco routine)
* or vector z less than cosine(arctan(z)) = 1/sqrt(17) */
const double zbreak = 0.242535625;
char c;
double c1,c2,sphi,cphi,st,ce,xaeo,yaeo,zaeo,v[3],
xmhdo,ymhdo,zmhdo,az,sz,zdo,tz,dref,zdt,
xaet,yaet,zaet,xmhda,ymhda,zmhda,diurab,f,hma;
/* coordinate type */
c = type[0];
/* coordinates */
c1 = ob1;
c2 = ob2;
/* sin, cos of latitude */
sphi = aoprms[1];
cphi = aoprms[2];
/* local apparent sidereal time */
st = aoprms[13];
/* standardise coordinate type */
if (c == 'r' || c == 'R') {
c = 'r';
} else if (c == 'h' || c == 'H') {
c = 'h';
} else {
c = 'a';
}
/* if az,zd convert to cartesian (s=0,e=90) */
if (c == 'a') {
ce = sin(c2);
xaeo = -cos(c1)*ce;
yaeo = sin(c1)*ce;
zaeo = cos(c2);
} else {
/* if ra,dec convert to ha,dec */
if (c == 'r') {
c1 = st-c1;
}
/* to cartesian -ha,dec */
palDcs2c( -c1, c2, v );
xmhdo = v[0];
ymhdo = v[1];
zmhdo = v[2];
/* to cartesian az,el (s=0,e=90) */
xaeo = sphi*xmhdo-cphi*zmhdo;
yaeo = ymhdo;
zaeo = cphi*xmhdo+sphi*zmhdo;
}
/* azimuth (s=0,e=90) */
if (xaeo != 0.0 || yaeo != 0.0) {
az = atan2(yaeo,xaeo);
} else {
az = 0.0;
}
( run in 3.153 seconds using v1.01-cache-2.11-cpan-2aafcb1aa8b )