Changeset 18753 for branches/eam_branch_20080719/pswarp/src/pswarpMapGrid.c
- Timestamp:
- Jul 27, 2008, 12:41:58 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080719/pswarp/src/pswarpMapGrid.c
r12523 r18753 4 4 // coordinates (src) to destination coordinates (dest). we construct a grid with superpixel 5 5 // spacing of nXpix, nYpix. The transformation for each grid cell is valid for the superpixel. 6 // The grid over-fills the source image so ever source image pixel is guaranteed to have a map.6 // The grid over-fills the source image so every source image pixel is guaranteed to have a map. 7 7 pswarpMapGrid *pswarpMapGridFromImage (pmReadout *dest, pmReadout *src, int nXpix, int nYpix) { 8 8 … … 11 11 12 12 // start counting from the center of the superpixels 13 intxMin = 0.5*nXpix;14 intyMin = 0.5*nYpix;13 double xMin = 0.5*nXpix; 14 double yMin = 0.5*nYpix; 15 15 16 16 // the map is defined for coordinates in the image parent frame. … … 42 42 43 43 // set the grid coordinate (gridX,gridY) for the given source image coordinate (ix,iy) 44 // XXX return true if the result is on the src image, false otherwise (???) 44 45 bool pswarpMapGridSetGrid (pswarpMapGrid *grid, int ix, int iy, int *gridX, int *gridY) { 45 46 46 47 *gridX = 0.5 + (ix - grid->xMin) / (double) grid->nXpix; 47 48 *gridY = 0.5 + (iy - grid->yMin) / (double) grid->nYpix; 49 50 return true; 51 } 52 53 // given the specified grid coordinate (gridX, gridY), return the min and max coordinates for the tile 54 bool pswarpMapGridCoordRange (pswarpMapGrid *grid, int gridX, int gridY, psPlane *min, psPlane *max) { 55 56 min->x = (gridX - 0.5)*grid->nXpix + grid->xMin; 57 min->y = (gridY - 0.5)*grid->nYpix + grid->yMin; 58 59 max->x = min->x + grid->nXpix; 60 max->y = min->y + grid->nYpix; 61 48 62 return true; 49 63 }
Note:
See TracChangeset
for help on using the changeset viewer.
