FACT++  1.0
void palRdplan ( double  date,
int  np,
double  elong,
double  phi,
double *  ra,
double *  dec,
double *  diam 
)

Definition at line 101 of file palRdplan.c.

References eraAnp(), eraC2s(), eraRxp(), i, PAL__CR, palDmoon(), palDt(), palEpj(), palGmst(), palNut(), palPlanet(), palPrenut(), and palPvobs().

Referenced by PointingModel::CalcPointingPos(), and t_planet().

102  {
103 
104  /* AU in km */
105  const double AUKM = 1.49597870e8;
106 
107  /* Equatorial radii (km) */
108  const double EQRAU[] = {
109  696000.0, /* Sun */
110  2439.7,
111  6051.9,
112  1738,
113  3397,
114  71492,
115  60268,
116  25559,
117  24764
118  };
119 
120  /* Local variables */
121  int i, j;
122  double stl;
123  double vgm[6];
124  double v[6];
125  double rmat[3][3];
126  double vse[6];
127  double vsg[6];
128  double vsp[6];
129  double vgo[6];
130  double dx,dy,dz,r,tl;
131 
132  /* Classify np */
133  if (np < 0 || np > 8 ) np=0; /* Sun */
134 
135  /* Approximate local sidereal time */
136  stl = palGmst( date - palDt( palEpj(date)) / 86400.0) + elong;
137 
138  /* Geocentre to Moon (mean of date) */
139  palDmoon( date, v );
140 
141  /* Nutation to true of date */
142  palNut( date, rmat );
143  eraRxp( rmat, v, vgm );
144  eraRxp( rmat, &(v[3]), &(vgm[3]) );
145 
146  /* Moon? */
147  if (np == 3) {
148 
149  /* geocentre to Moon (true of date) */
150  for (i=0; i<6; i++) {
151  v[i] = vgm[i];
152  }
153 
154  } else {
155 
156  /* Not moon: precession/nutation matrix J2000 to date */
157  palPrenut( 2000.0, date, rmat );
158 
159  /* Sun to Earth-Moon Barycentre (J2000) */
160  palPlanet( date, 3, v, &j );
161 
162  /* Precession and nutation to date */
163  eraRxp( rmat, v, vse );
164  eraRxp( rmat, &(v[3]), &(vse[3]) );
165 
166  /* Sun to geocentre (true of date) */
167  for (i=0; i<6; i++) {
168  vsg[i] = vse[i] - 0.012150581 * vgm[i];
169  }
170 
171  /* Sun ? */
172  if (np == 0) {
173 
174  /* Geocentre to Sun */
175  for (i=0; i<6; i++) {
176  v[i] = -vsg[i];
177  }
178 
179  } else {
180 
181  /* Sun to Planet (J2000) */
182  palPlanet( date, np, v, &j );
183 
184  /* Precession and nutation to date */
185  eraRxp( rmat, v, vsp );
186  eraRxp( rmat, &(v[3]), &(vsp[3]) );
187 
188  /* Geocentre to planet */
189  for (i=0; i<6; i++) {
190  v[i] = vsp[i] - vsg[i];
191  }
192 
193  }
194 
195  }
196 
197  /* Refer to origina at the observer */
198  palPvobs( phi, 0.0, stl, vgo );
199  for (i=0; i<6; i++) {
200  v[i] -= vgo[i];
201  }
202 
203  /* Geometric distance (AU) */
204  dx = v[0];
205  dy = v[1];
206  dz = v[2];
207  r = sqrt( dx*dx + dy*dy + dz*dz );
208 
209  /* Light time */
210  tl = PAL__CR * r;
211 
212  /* Correct position for planetary aberration */
213  for (i=0; i<3; i++) {
214  v[i] -= tl * v[i+3];
215  }
216 
217  /* To RA,Dec */
218  eraC2s( v, ra, dec );
219  *ra = eraAnp( *ra );
220 
221  /* Angular diameter (radians) */
222  *diam = 2.0 * asin( EQRAU[np] / (r * AUKM ) );
223 
224 }
static const double PAL__CR
Definition: palmac.h:99
void palNut(double date, double rmatn[3][3])
Definition: palNut.c:76
void palPrenut(double epoch, double date, double rmatpn[3][3])
Definition: palPrenut.c:70
double palEpj(double date)
Definition: palOne2One.c:1169
int i
Definition: db_dim_client.c:21
double palDt(double epoch)
Definition: palDt.c:97
void palDmoon(double date, double pv[6])
Definition: palDmoon.c:95
void eraC2s(double p[3], double *theta, double *phi)
Definition: c2s.c:3
void eraRxp(double r[3][3], double p[3], double rp[3])
Definition: rxp.c:3
void palPvobs(double p, double h, double stl, double pv[6])
Definition: palPvobs.c:77
double eraAnp(double a)
Definition: anp.c:3
void palPlanet(double date, int np, double pv[6], int *j)
Definition: palPlanet.c:82
double palGmst(double ut1)
Definition: palOne2One.c:1332

+ Here is the call graph for this function:

+ Here is the caller graph for this function: