[SCM] Handle World Coordinate Systems in Astronomy branch, debian, updated. 524039ea360c70344cee0e0073ef601ef96a0fcb

Ole Streicher debian at liska.ath.cx
Thu Feb 9 15:49:11 UTC 2012


The following commit has been merged in the debian branch:
commit 5aaf4fca931bd81703d09dd4dad69d0fc7e46531
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Thu Feb 9 16:30:27 2012 +0100

    Move palSlaDe2h and palSlaDh2e from pal.c to slamap.c

diff --git a/debian/patches/use_slalib.patch b/debian/patches/use_slalib.patch
index 2e43280..ae5ff9b 100644
--- a/debian/patches/use_slalib.patch
+++ b/debian/patches/use_slalib.patch
@@ -3,9 +3,11 @@ Description: Since the obfuscated "pal.c" library cannot be used here,
  us the external library "libsla". Both are compatible; just the names
  differ by the prefix "pal" due to a requirement of the original author.
  This patch fixes the names as #defines# in the header file.
+ One exception are the palSlaDh2e and palSlaDe2h functions which are moved 
+ from pal.c to slamap.c.
 --- a/pal.h
 +++ b/pal.h
-@@ -1,510 +1,192 @@
+@@ -1,510 +1,190 @@
  #ifndef PALHDEF
  #define PALHDEF
 -/*
@@ -558,7 +560,6 @@ Description: Since the obfuscated "pal.c" library cannot be used here,
 +#define palSlaDe2h slaDe2h 
 +#define palSlaDeuler slaDeuler 
 +#define palSlaDfltin slaDfltin 
-+#define palSlaDh2eslaDh2e
 +#define palSlaDimxv slaDimxv 
 +#define palSlaDjcal slaDjcal 
 +#define palSlaDjcl slaDjcl 
@@ -588,7 +589,6 @@ Description: Since the obfuscated "pal.c" library cannot be used here,
 +#define palSlaDvdv slaDvdv 
 +#define palSlaDvn slaDvn 
 +#define palSlaDvxv slaDvxv 
-+#define palSlaE2h slaE2h 
 +#define palSlaEarth slaEarth 
 +#define palSlaEcleq slaEcleq 
 +#define palSlaEcmat slaEcmat 
@@ -703,3 +703,100 @@ Description: Since the obfuscated "pal.c" library cannot be used here,
 +#define palSlaZd slaZd 
  
  #endif
+--- a/slamap.c
++++ b/slamap.c
+@@ -284,6 +284,94 @@ static void J2000H( int, int, double *, double *, int * );
+ static int GetObjSize( AstObject *, int * );
+ /* Member functions. */
+ /* ================= */
++
++/* Not quite like slaDh2e since it converts from topocentric (az,el) to
++   apparent (ha,dec). This includes a correction for diurnal aberration.
++   The magnitude of the diurnal aberration vector should be supplied in
++   parameter "diurab". The extra code is taken from the Fortran routine
++   SLA_OAPQK. */
++
++void palSlaDh2e(double az,double el,double phi,double diurab,double *ha,double *dec){
++ double sa,ca,se,ce,sp,cp,x,y,z,r,xmhda,ymhda,zmhda,f;
++
++ sa=sin(az);
++ ca=cos(az);
++ se=sin(el);
++ ce=cos(el);
++ sp=sin(phi);
++ cp=cos(phi);
++
++/* Cartesian (az,el) to Cartesian (ha,dec) - note, +ha, not -ha. */
++ xmhda=-ca*ce*sp+se*cp;
++ ymhda=-sa*ce;
++ zmhda=ca*ce*cp+se*sp;
++
++/* Correct this vector for diurnal aberration. Since the above
++  expressions produce +ha rather than -ha, we do not negate "diurab"
++  before using it. Compare this to SLA_AOPQK. */
++ f = (1-diurab*ymhda);
++ x = f*xmhda;
++ y = f*(ymhda+diurab);
++ z = f*zmhda;
++
++/* Cartesian (ha,dec) to spherical (ha,dec). */
++ r=sqrt(x*x+y*y);
++ if (r==0.0) {
++    *ha=0.0;
++ } else {
++    *ha=atan2(y,x);
++ }
++ *dec=atan2(z,r);
++}
++
++/* Not quite like slaDe2h since it converts from apparent (ha,dec) to
++   topocentric (az,el). This includes a correction for diurnal
++   aberration. The magnitude of the diurnal aberration vector should be
++   supplied in parameter "diurab". The extra code is taken from the
++   Fortran routine SLA_AOPQK. */
++
++void palSlaDe2h( double ha, double dec, double phi, double diurab,
++                 double *az, double *el){
++ double sh,ch,sd,cd,sp,cp,x,y,z,r,a,xhd,yhd,zhd,xhdt,yhdt,zhdt,f;
++
++ sh=sin(ha);
++ ch=cos(ha);
++ sd=sin(dec);
++ cd=cos(dec);
++ sp=sin(phi);
++ cp=cos(phi);
++
++/* Components of cartesian (-ha,dec) vector. */
++ xhd = ch*cd;
++ yhd = -sh*cd;
++ zhd = sd;
++
++/* Modify the above vector to apply diurnal aberration. */
++ f = (1.0-diurab*yhd);
++ xhdt = f*xhd;
++ yhdt = f*(yhd+diurab);
++ zhdt = f*zhd;
++
++/* Convert to cartesian (az,el). */
++ x=-xhdt*sp+zhdt*cp;
++ y=yhdt;
++ z=xhdt*cp+zhdt*sp;
++
++/* Convert to spherical (az,el). */
++ r=sqrt(x*x+y*y);
++ if( r == 0.0 ) {
++    a=0.0;
++ } else {
++    a=atan2(y,x);
++ }
++
++ if(a<0.0) a=a+2*M_PI;
++
++ *az=a;
++ *el=atan2(z,r);
++}
++
++
+ static int Equal( AstObject *this_object, AstObject *that_object, int *status ) {
+ /*
+ *  Name:

-- 
Handle World Coordinate Systems in Astronomy



More information about the debian-science-commits mailing list