IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 21, 2014, 11:42:48 AM (12 years ago)
Author:
eugene
Message:

handle 0,360 boundary correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140206/Ohana/src/relphot/src/MosaicOps.c

    r36611 r36612  
    575575      image[m].Xm    = NAN_S_SHORT;
    576576    }
     577
    577578    if (Nc > 0) {
    578579      dsort (Rc, Nc);
     580      if (Rc[Nc-1] - Rc[0] > 180.0) {
     581        // in our list, Rc is in the range 0.0 to 360.0. 
     582        // any mosaic which is close to the 0.0, 360.0 boundary may have some on
     583        // one side or the other.  count how many have values more than Rc[0] + 180.
     584        // if more than half are at the large end, re-normalize to that range
     585        int Nbig = 0;
     586        for (j = 1; j < Nc; j++) {
     587          if (Rc[j] - Rc[0] > 180.0) Nbig ++;
     588        }
     589        if (Nbig  > 0.5*Nc) {
     590          for (j = 0; j < Nc; j++) {
     591            Rc[j] = ohana_normalize_angle_to_midpoint (Rc[j], 360.0);
     592          }
     593          dsort (Rc, Nc);
     594        } else if (Nbig > 0) {
     595          for (j = 0; j < Nc; j++) {
     596            Rc[j] = ohana_normalize_angle_to_midpoint (Rc[j], 0.0);
     597          }
     598          dsort (Rc, Nc);
     599        }
     600      }
    579601      dsort (Dc, Nc);
     602
    580603      Rmid = Rc[(int)(0.5*Nc)];
    581604      Dmid = Dc[(int)(0.5*Nc)];
Note: See TracChangeset for help on using the changeset viewer.