IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 21, 2008, 5:53:10 PM (18 years ago)
Author:
Paul Price
Message:

Sometimes the index rolls over.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageInterpolate.c

    r20315 r20317  
    77 *  @author Paul Price, IfA
    88 *
    9  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-10-22 03:05:00 $
     9 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-10-22 03:53:10 $
    1111 *
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    483483        const psVector *sumKernel2 = interp->sumKernel2; // Pre-calculated kernel^2
    484484        int xIndex = xFrac * numKernels + 0.5; // Index of closest pre-calculated kernel
     485        if (xIndex == numKernels) {
     486            xIndex = 0;
     487        }
     488        psAssert(xIndex >=0 && xIndex < numKernels, "xIndex is %d", xIndex);
    485489        xKernel = kernel->data.F32[xIndex];
    486490        xKernel2 = kernel2->data.F32[xIndex];
    487491        xSumKernel2 = sumKernel2->data.F32[xIndex];
    488492        int yIndex = yFrac * numKernels + 0.5; // Index of closest pre-calculated kernel
     493        if (yIndex == numKernels) {
     494            yIndex = 0;
     495        }
     496        psAssert(yIndex >=0 && yIndex < numKernels, "yIndex is %d", yIndex);
    489497        yKernel = kernel->data.F32[yIndex];
    490498        yKernel2 = kernel2->data.F32[yIndex];
Note: See TracChangeset for help on using the changeset viewer.