IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 7, 2005, 10:21:59 PM (21 years ago)
Author:
eugene
Message:

added mosaic astrometry functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/ImageOps.c

    r2598 r3393  
    99  int *subset;
    1010  int N, n, npts;
    11   double r, d, x[4], y[4], Rmin, Rmax, Rmid;
    12   double X[8], Y[8];
     11  double r, d, X, Y, x[4], y[4], Rmin, Rmax, Rmid;
    1312
    1413  if (RegionSelect) {
     
    1615    Rmax = graph[0].coords.crval1 + 182.0;
    1716    Rmid = 0.5*(Rmin + Rmax);
     17    BuildChipMatch (image, Nimage);
    1818  }
    1919
     
    2222    trange = fabs (trange);
    2323  }
    24   status = InPic = TRUE;
     24
    2525  npts = 200;
    2626  ALLOCATE (subset, int, npts);
     
    2929    if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue;
    3030    if (RegionSelect) {
     31      if (!FindMosaicForImage (image, Nimage, i)) continue;
    3132      /* project this image to screen display coords */
    3233      x[0] = 0;           y[0] = 0;
     
    3435      x[2] = image[i].NX; y[2] = image[i].NY;
    3536      x[3] = 0;           y[3] = image[i].NY;
    36       status = FALSE;
    37       flipped = FALSE;
     37      InPic = flipped = FALSE;
    3838      for (j = 0; j < 4; j++) {
    3939        XY_to_RD (&r, &d, x[j], y[j], &image[i].coords);
    40         while ((j == 0) && (r < Rmin)) { flipped = TRUE; r += 360.0; }
    41         while ((j == 0) && (r > Rmax)) { flipped = TRUE; r -= 360.0; }
    42         if ((j > 0) && flipped) {
    43           while (r < Rmid) r+= 360.0;
    44           while (r > Rmid) r-= 360.0;
     40        /* use same side of 0,360 boundary for all corners */
     41        if ((j == 0) && (r < Rmin)) flipped = TRUE;
     42        if ((j == 0) && (r > Rmax)) flipped = TRUE;
     43        while (flipped && (r < Rmid)) r+= 360.0;
     44        while (flipped && (r > Rmid)) r-= 360.0;
     45        status = RD_to_XY (&X, &Y, r, d, &graph[0].coords);
     46
     47        if (!status) continue;
     48        if (X < graph[0].xmin) continue;
     49        if (X > graph[0].xmax) continue;
     50        if (Y < graph[0].ymin) continue;
     51        if (Y > graph[0].ymax) continue;
     52        subset[n] = i;
     53        n++;
     54        if (n > npts - 1) {
     55          npts += 200;
     56          REALLOCATE (subset, int, npts);
    4557        }
    46         status |= RD_to_XY (&X[2*j], &Y[2*j], r, d, &graph[0].coords);
    47         if (j > 0) {
    48           X[2*j - 1] = X[2*j];
    49           Y[2*j - 1] = Y[2*j];
    50         }
     58        break;
    5159      }
    52       X[7] = X[0];
    53       Y[7] = Y[0];
    54       InPic = FALSE;
    55       for (j = 0; status && (j < 8); j+=2) {
    56         if ((X[j] >= graph[0].xmin) &&
    57             (X[j] <= graph[0].xmax) &&
    58             (Y[j] >= graph[0].ymin) &&
    59             (Y[j] <= graph[0].ymax))
    60           InPic = TRUE;
    61       }
    62     }
    63     if (InPic && status) {
    64       subset[n] = i;
    65       n++;
    66       if (n > npts - 1) {
    67         npts += 200;
    68         REALLOCATE (subset, int, npts);
    69       }
     60      /** we miss any images which surround the region.  we are also
     61          missing the DIS images for which the corners don't touch
     62          the region, but which are needed for WRP images with
     63          corners touching the region **/
    7064    }
    7165  }
Note: See TracChangeset for help on using the changeset viewer.