FACT++  1.0
void palDs2tp ( double  ra,
double  dec,
double  raz,
double  decz,
double *  xi,
double *  eta,
int *  j 
)

Definition at line 83 of file palDs2tp.c.

Referenced by t_tp().

84  {
85 
86  const double TINY = 1.0e-6;
87 
88  double cdec;
89  double sdec;
90  double radif;
91  double cdecz;
92  double denom;
93  double sdecz;
94  double cradif;
95  double sradif;
96 
97  /* Trig functions */
98  sdecz = sin(decz);
99  sdec = sin(dec);
100  cdecz = cos(decz);
101  cdec = cos(dec);
102  radif = ra - raz;
103  sradif = sin(radif);
104  cradif = cos(radif);
105 
106  /* Reciprocal of star vector length to tangent plane */
107  denom = sdec * sdecz + cdec * cdecz * cradif;
108 
109  /* Handle vectors too far from axis */
110  if (denom > TINY) {
111  *j = 0;
112  } else if (denom >= 0.) {
113  *j = 1;
114  denom = TINY;
115  } else if (denom > -TINY) {
116  *j = 2;
117  denom = -TINY;
118  } else {
119  *j = 3;
120  }
121 
122  /* Compute tangent plane coordinates (even in dubious cases) */
123  *xi = cdec * sradif / denom;
124  *eta = (sdec * cdecz - cdec * sdecz * cradif) / denom;
125 
126  return;
127 }

+ Here is the caller graph for this function: