IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20665


Ignore:
Timestamp:
Nov 10, 2008, 4:27:30 PM (17 years ago)
Author:
bills
Message:

convert to integer when naming coordinates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/warpedpixels.c

    r20573 r20665  
    3333    }
    3434
    35     bool writeTouchedPixels = false;
     35    bool writeTouchedPixels = false; // XXX: make this an argument to the program
    3636    if (writeTouchedPixels) {
    3737        // write out the warped pixels
     
    123123    // Now set the touched pixels
    124124    int ymin = fmax(0, pt[1].y);
    125     int ymax = fmin(pt[3].y, sf->warpedPixels->numRows);
     125    int ymax = fmin(pt[3].y + .5, sf->warpedPixels->numRows - 1);
    126126#ifdef DEBUG_PRINT
    127127    printf("\nymin: %d ymax: %d\n", ymin, ymax);
    128128#endif
    129     for (int y = ymin ; y < ymax; y++) {
     129    for (int y = ymin ; y <= ymax; y++) {
    130130        int xleft  = xLeft(pt, y);
    131131        int xright = xRight(pt, y);
     
    177177        x_d = xOfY(&pt[0], &pt[3], y);
    178178    }
    179     return (int) x_d;
     179    return (int) (x_d + 0.5);
    180180}
    181181
     
    266266    /* find pt0 the left most (bottom most) corner */
    267267    int imin = 0;
    268     double  min = pt[0].x;
     268    int  min = (int) pt[0].x;
    269269    int i;
    270     for (i=0; i<4; i++) {
    271         double x = pt[i].x;
     270    for (i=1; i<4; i++) {
     271        int x = pt[i].x;
    272272        if ((x < min) ||
    273273            ((x == min) && (pt[i].y < pt[imin].y))) {
     
    285285    imin = 0;
    286286    min = pt[0].y;
    287     for (i=0; i<3; i++) {
    288         double y = pt[i].y;
     287    for (i=1; i<3; i++) {
     288        int y = pt[i].y;
    289289        if ((y < min) ||
    290290            ((y == min) && (pt[i].x > pt[imin].x)) ) {
Note: See TracChangeset for help on using the changeset viewer.