#--------------------------------------------------------------------------- .help cf_calc_range May94 source .ih NAME cf_calc_range -- Calculate starting pixel and length of array. .endhelp #--------------------------------------------------------------------------- procedure cf_calc_range (start_pixel, end_pixel, center, size, length, start, range) int start_pixel # I: Start pixel of range. int end_pixel # I: End pixel of range. int center # I: Center pixel of range. int size # I: Size of range. int length # I: Total length of array. int start # O: Start pixel. int range # O: Number of pixels in range. int i # Generic. begin if (IS_INDEFI(start_pixel) || IS_INDEFI(end_pixel)) { if (IS_INDEFI(center)) i = length / 2 else i = center start = i - (size / 2) range = size } else { start = start_pixel range = end_pixel - start_pixel + 1 } # Check for consistency on the pixel range. if (start < 1 || start+range-1 > length) call error (1, "cf_calc_range: range out of bounds") end #--------------------------------------------------------------------------- # End of cf_calc_range #---------------------------------------------------------------------------