FACT++  1.0
void palFk524 ( double  r2000,
double  d2000,
double  dr2000,
double  dd2000,
double  p2000,
double  v2000,
double *  r1950,
double *  d1950,
double *  dr1950,
double *  dd1950,
double *  p1950,
double *  v1950 
)

Definition at line 132 of file palFk524.c.

References i, PAL__D2PI, PAL__PMF, and PAL__VF.

Referenced by palFk54z(), and t_fk524().

134  {
135 
136 /* Local Variables; */
137  double r, d, ur, ud, px, rv;
138  double sr, cr, sd, cd, x, y, z, w;
139  double v1[ 6 ], v2[ 6 ];
140  double xd, yd, zd;
141  double rxyz, wd, rxysq, rxy;
142  int i, j;
143 
144 /* Small number to avoid arithmetic problems. */
145  static const double tiny = 1.0E-30;
146 
147 /* Canonical constants (see references). Constant vector and matrix. */
148  double a[ 6 ] = { -1.62557E-6, -0.31919E-6, -0.13843E-6,
149  +1.245E-3, -1.580E-3, -0.659E-3 };
150  double emi[ 6 ][ 6 ] = {
151  { 0.9999256795, 0.0111814828, 0.0048590039,
152  -0.00000242389840, -0.00000002710544, -0.00000001177742},
153  {-0.0111814828, 0.9999374849, -0.0000271771,
154  0.00000002710544, -0.00000242392702, 0.00000000006585 },
155  {-0.0048590040, -0.0000271557, 0.9999881946,
156  0.00000001177742, 0.00000000006585, -0.00000242404995 },
157  {-0.000551, 0.238509, -0.435614,
158  0.99990432, 0.01118145, 0.00485852 },
159  {-0.238560, -0.002667, 0.012254,
160  -0.01118145, 0.99991613, -0.00002717},
161  { 0.435730, -0.008541, 0.002117,
162  -0.00485852, -0.00002716, 0.99996684 } };
163 
164 /* Pick up J2000 data (units radians and arcsec/JC). */
165  r = r2000;
166  d = d2000;
167  ur = dr2000*PAL__PMF;
168  ud = dd2000*PAL__PMF;
169  px = p2000;
170  rv = v2000;
171 
172 /* Spherical to Cartesian. */
173  sr = sin( r );
174  cr = cos( r );
175  sd = sin( d );
176  cd = cos( d );
177 
178  x = cr*cd;
179  y = sr*cd;
180  z = sd;
181 
182  w = PAL__VF*rv*px;
183 
184  v1[ 0 ] = x;
185  v1[ 1 ] = y;
186  v1[ 2 ] = z;
187 
188  v1[ 3 ] = -ur*y - cr*sd*ud + w*x;
189  v1[ 4 ] = ur*x - sr*sd*ud + w*y;
190  v1[ 5 ] = cd*ud + w*z;
191 
192 /* Convert position+velocity vector to BN system. */
193  for( i = 0; i < 6; i++ ) {
194  w = 0.0;
195  for( j = 0; j < 6; j++ ) {
196  w += emi[ i ][ j ]*v1[ j ];
197  }
198  v2[ i ] = w;
199  }
200 
201 /* Position vector components and magnitude. */
202  x = v2[ 0 ];
203  y = v2[ 1 ];
204  z = v2[ 2 ];
205  rxyz = sqrt( x*x + y*y + z*z );
206 
207 /* Apply E-terms to position. */
208  w = x*a[ 0 ] + y*a[ 1 ] + z*a[ 2 ];
209  x += a[ 0 ]*rxyz - w*x;
210  y += a[ 1 ]*rxyz - w*y;
211  z += a[ 2 ]*rxyz - w*z;
212 
213 /* Recompute magnitude. */
214  rxyz = sqrt( x*x + y*y + z*z );
215 
216 /* Apply E-terms to both position and velocity. */
217  x = v2[ 0 ];
218  y = v2[ 1 ];
219  z = v2[ 2 ];
220  w = x*a[ 0 ] + y*a[ 1 ] + z*a[ 2 ];
221  wd = x*a[ 3 ] + y*a[ 4 ] + z*a[ 5 ];
222  x += a[ 0 ]*rxyz - w*x;
223  y += a[ 1 ]*rxyz - w*y;
224  z += a[ 2 ]*rxyz - w*z;
225  xd = v2[ 3 ] + a[ 3 ]*rxyz - wd*x;
226  yd = v2[ 4 ] + a[ 4 ]*rxyz - wd*y;
227  zd = v2[ 5 ] + a[ 5 ]*rxyz - wd*z;
228 
229 /* Convert to spherical. */
230  rxysq = x*x + y*y;
231  rxy = sqrt( rxysq );
232 
233  if( x == 0.0 && y == 0.0 ) {
234  r = 0.0;
235  } else {
236  r = atan2( y, x );
237  if( r < 0.0 ) r += PAL__D2PI;
238  }
239  d = atan2( z, rxy );
240 
241  if( rxy > tiny ) {
242  ur = ( x*yd - y*xd )/rxysq;
243  ud = ( zd*rxysq - z*( x*xd + y*yd ) )/( ( rxysq + z*z )*rxy );
244  }
245 
246 /* Radial velocity and parallax. */
247  if( px > tiny ) {
248  rv = ( x*xd + y*yd + z*zd )/( px*PAL__VF*rxyz );
249  px /= rxyz;
250  }
251 
252 /* Return results. */
253  *r1950 = r;
254  *d1950 = d;
255  *dr1950 = ur/PAL__PMF;
256  *dd1950 = ud/PAL__PMF;
257  *p1950 = px;
258  *v1950 = rv;
259 }
int i
Definition: db_dim_client.c:21
double w
Definition: palObs.c:168
static const double PAL__VF
Definition: palmac.h:106
#define PAL__PMF
Definition: palmac.h:110
static const double PAL__D2PI
Definition: palmac.h:66

+ Here is the caller graph for this function: