IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2008, 8:08:31 AM (18 years ago)
Author:
eugene
Message:

replace poor code with ohana_normalize_angle

Location:
trunk/Ohana/src/opihi/cmd.astro
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/cplot.c

    r14066 r19823  
    4141  Npts = 0;
    4242  for (i = 0; i < Xvec.Nelements; i++, r++, d++) {
     43      *r = ohana_normalize_angle (*r);
    4344    while (*r < Rmin) *r += 360.0;
    4445    while (*r > Rmax) *r -= 360.0;
  • trunk/Ohana/src/opihi/cmd.astro/czplot.c

    r13479 r19823  
    4949  for (i = 0; i < Zvec.Nelements; i++, in++, out++, r++, d++, x++, y++) {
    5050    *out = MIN (1.0, MAX (0.01, (*in - min) / range));
    51     while (*r < Rmin) *r += 360.0;
    52     while (*r > Rmax) *r -= 360.0;
     51    *r = ohana_normalize_angle (*r);
    5352    fRD_to_XY (x, y, *r, *d, &graphmode.coords);
    5453  }
  • trunk/Ohana/src/opihi/cmd.astro/drizzle.c

    r8427 r19823  
    221221  *phi   = DEG_RAD*atan2(y,x) + rot_phi;
    222222 
    223   while (*phi <   0.0) *phi += 360.0;
    224   while (*phi > 360.0) *phi -= 360.0;
     223  *phi = ohana_normalize_angle(*phi);
    225224  return (TRUE);
    226225}
  • trunk/Ohana/src/opihi/cmd.astro/getvel.c

    r7917 r19823  
    4343  dV *= 0.001;
    4444
    45   while (L >= 360) {L -= 360.0;}
    46   while (L < 0.0)  {L += 360.0;}
     45  L = ohana_normalize_angle (L);
    4746  gprint (GP_ERR, "L: %f\n", L);
    4847
  • trunk/Ohana/src/opihi/cmd.astro/polar.c

    r7917 r19823  
    5555      y = (j - Yo) * dN + No;
    5656      r = hypot(x, y);
    57       t = DEG_RAD*atan2 (y, x);
    58       while (t < 360.0) {t += 360.0;}
    59       while (t > 360.0) {t -= 360.0;}
     57      t = ohana_normalize_angle(DEG_RAD*atan2 (y, x));
    6058      X = (t - Lo) / dL + xo;
    6159      Y = (r - Do) / dD + yo;
  • trunk/Ohana/src/opihi/cmd.astro/rotcurve.c

    r7917 r19823  
    7070  gfits_scan (&out[0].header, "CRPIX2", "%lf", 1, &Yo);
    7171
    72   while (L >= 360) {L -= 360.0;}
    73   while (L < 0.0)  {L += 360.0;}
     72  L = ohana_normalize_angle (L);
     73
    7474  X = (L - Lo) / dL + Xo;
    7575  if ((X >= Nx) || (X < 0)) {
Note: See TracChangeset for help on using the changeset viewer.