IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 7, 2007, 4:14:29 PM (20 years ago)
Author:
eugene
Message:

working version with locally-linear map

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpMapGrid.c

    r10957 r10958  
    55pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix) {
    66
     7    int i, ni;
     8    int j, nj;
     9
    710    // split the difference of the remainder
    811    int xMin = 0.5*(src->image->numCols % nXpix);
    912    int yMin = 0.5*(src->image->numRows % nYpix);
    1013
    11     pswarpMapGrid *grid = pswarpMapGridAlloc (src->image->numCols / nXpix, src->image->numRows / nYpix);
    12 
    13     int ni = 0;
    14     int nj = 0;
    15     for (int i = xMin; i < src->image->numCols; i += nXpix, ni++) {
    16         for (int j = yMin; j < src->image->numRows; j += nYpix, nj++) {
     14    int nXpts = src->image->numCols / nXpix;
     15    if (src->image->numCols % nXpix == 0) nXpts ++;
     16    int nYpts = src->image->numRows / nYpix;
     17    if (src->image->numRows % nYpix == 0) nYpts ++;
     18
     19    pswarpMapGrid *grid = pswarpMapGridAlloc (nXpts, nYpts);
     20
     21    for (ni = 0, i = xMin; ni < nXpts; i += nXpix, ni++) {
     22        for (nj = 0, j = yMin; nj < nYpts; j += nYpix, nj++) {
    1723            pswarpMapSetLocalModel (grid->maps[ni][nj], dest, src, i, j);
    1824        }
     
    128134    map->Xx = V10->x - V00->x;
    129135    map->Xy = V01->x - V00->x;
    130     map->Xo = V00->x + map->Xx*ix + map->Xy*iy;
     136    map->Xo = V00->x - map->Xx*ix - map->Xy*iy;
    131137
    132138    map->Yx = V10->y - V00->y;
    133139    map->Yy = V01->y - V00->y;
    134     map->Yo = V00->y + map->Yx*ix + map->Yy*iy;
     140    map->Yo = V00->y - map->Yx*ix - map->Yy*iy;
    135141 
    136142    map->xo = ix;
Note: See TracChangeset for help on using the changeset viewer.