FACT++  1.0
double eraPap ( double  a[3],
double  b[3] 
)

Definition at line 3 of file pap.c.

References eraPdp(), eraPm(), eraPmp(), eraPn(), and eraPxp().

Referenced by palDpav(), and t_pap().

43 {
44  double am, au[3], bm, st, ct, xa, ya, za, eta[3], xi[3], a2b[3], pa;
45 
46 /* Modulus and direction of the a vector. */
47  eraPn(a, &am, au);
48 
49 /* Modulus of the b vector. */
50  bm = eraPm(b);
51 
52 /* Deal with the case of a null vector. */
53  if ((am == 0.0) || (bm == 0.0)) {
54  st = 0.0;
55  ct = 1.0;
56  } else {
57 
58  /* The "north" axis tangential from a (arbitrary length). */
59  xa = a[0];
60  ya = a[1];
61  za = a[2];
62  eta[0] = -xa * za;
63  eta[1] = -ya * za;
64  eta[2] = xa*xa + ya*ya;
65 
66  /* The "east" axis tangential from a (same length). */
67  eraPxp(eta, au, xi);
68 
69  /* The vector from a to b. */
70  eraPmp(b, a, a2b);
71 
72  /* Resolve into components along the north and east axes. */
73  st = eraPdp(a2b, xi);
74  ct = eraPdp(a2b, eta);
75 
76  /* Deal with degenerate cases. */
77  if ((st == 0.0) && (ct == 0.0)) ct = 1.0;
78  }
79 
80 /* Position angle. */
81  pa = atan2(st, ct);
82 
83  return pa;
84 
85 }
double eraPdp(double a[3], double b[3])
Definition: pdp.c:3
double eraPm(double p[3])
Definition: pm.c:3
void eraPxp(double a[3], double b[3], double axb[3])
Definition: pxp.c:3
void eraPmp(double a[3], double b[3], double amb[3])
Definition: pmp.c:3
void eraPn(double p[3], double *r, double u[3])
Definition: pn.c:3

+ Here is the call graph for this function:

+ Here is the caller graph for this function: