IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 24, 2008, 5:45:18 PM (18 years ago)
Author:
eugene
Message:

cleaning up the image/screen relationships and remap functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/src/CreateZoom32.c

    r16061 r16228  
    88  int dropback;  /* this is a bit of a kludge... */
    99  int dx, dy, DX, DY;
    10   double expand, zoomscale, Rx, Ry;
     10  double expand, zoomscale, Ix, Iy;
    1111  int expand_in, expand_out;
    1212  unsigned int *out_pix, *out_pix2;
     
    4040  DY = image[0].image[0].matrix.Naxis[1];
    4141 
    42   /* Rx,Ry are the screen coordinates of the first image pixel */
    43   Rx = x - expand*(int)(0.5*(dx + 1)) + 1;
    44   Ry = y - expand*(int)(0.5*(dy + 1)) + 1;
     42  /* Ix,Iy are the image coordinates of the first image pixel */
     43  // x,y is the image coordinate of the zoombox center
     44  Ix = x - expand*(int)(0.5*(dx + 1)) + 1;
     45  Iy = y - expand*(int)(0.5*(dy + 1)) + 1;
    4546
    46   i_start = MIN (MAX (-Rx / expand, (1 - FRAC(Rx)) / expand), dx - expand_out + 1);
    47   j_start = MIN (MAX (-Ry / expand, (1 - FRAC(Ry)) / expand), dy - expand_out + 1);
    48   i_end   = MAX (MIN ((DX-Rx) / expand, dx - expand_out + 1), 0);
    49   j_end   = MAX (MIN ((DY-Ry) / expand, dy - expand_out + 1), 0);
     47  i_start = MIN (MAX (-Ix / expand, (1 - FRAC(Ix)) / expand), dx - expand_out + 1);
     48  j_start = MIN (MAX (-Iy / expand, (1 - FRAC(Iy)) / expand), dy - expand_out + 1);
     49  i_end   = MAX (MIN ((DX-Ix) / expand, dx - expand_out + 1), 0);
     50  j_end   = MAX (MIN ((DY-Iy) / expand, dy - expand_out + 1), 0);
    5051
    5152  dropback = expand_out - (i_end - i_start) % expand_out;
     
    5354
    5455  out_pix = (unsigned int *) image[0].zoom.data;
    55   in_pix  = &image[0].pixmap[DX*(int)MAX(Ry,0) + (int)MAX(Rx,0)];
     56  in_pix  = &image[0].pixmap[DX*(int)MAX(Iy,0) + (int)MAX(Ix,0)];
    5657
    5758  /********** below we do the mapping from buffer pixels (in) to picture pixels (out) **********/
Note: See TracChangeset for help on using the changeset viewer.