FACT++  1.0
void palPv2ue ( const double  pv[6],
double  date,
double  pmass,
double  u[13],
int *  jstat 
)

Definition at line 114 of file palPv2ue.c.

References PAL__GCON, and PAL__SPD.

Referenced by palEl2ue(), palPertue(), and t_planet().

115  {
116 
117  /* Canonical days to seconds */
118  const double CD2S = PAL__GCON / PAL__SPD;
119 
120  /* Minimum allowed distance (AU) and speed (AU per canonical day) */
121  const double RMIN = 1e-3;
122  const double VMIN = 1e-3;
123 
124  double T0,CM,X,Y,Z,XD,YD,ZD,R,V2,V,ALPHA,RDV;
125 
126  /* Reference epoch. */
127  T0 = date;
128 
129  /* Combined mass (mu=M+m). */
130  if (pmass < 0.0 ) { /* Negative planet mass */
131  *jstat = -1;
132  return;
133  }
134  CM = 1.0+pmass;
135 
136  /* Unpack the state vector, expressing velocity in AU per canonical day. */
137  X = pv[0];
138  Y = pv[1];
139  Z = pv[2];
140  XD = pv[3]/CD2S;
141  YD = pv[4]/CD2S;
142  ZD = pv[5]/CD2S;
143 
144  /* Heliocentric distance, and speed. */
145  R = sqrt(X*X+Y*Y+Z*Z);
146  V2 = XD*XD+YD*YD+ZD*ZD;
147  V = sqrt(V2);
148 
149  /* Reject unreasonably small values. */
150  if (R < RMIN) { /* Too close */
151  *jstat = -2;
152  return;
153  }
154  if (V < VMIN) { /* Too slow */
155  *jstat = -3;
156  return;
157  }
158 
159  /* Total energy of the orbit. */
160  ALPHA = V2-2.0*CM/R;
161 
162  /* Outward component of velocity. */
163  RDV = X*XD+Y*YD+Z*ZD;
164 
165  /* Construct the universal-element set. */
166  u[0] = CM;
167  u[1] = ALPHA;
168  u[2] = T0;
169  u[3] = X;
170  u[4] = Y;
171  u[5] = Z;
172  u[6] = XD;
173  u[7] = YD;
174  u[8] = ZD;
175  u[9] = R;
176  u[10] = RDV;
177  u[11] = T0;
178  u[12] = 0.0;
179 
180  *jstat = 0;
181  return;
182 }
static const double PAL__GCON
Definition: palmac.h:117
static const double PAL__SPD
Definition: palmac.h:102

+ Here is the caller graph for this function: