PRO determine_range_overlap_1d, r1xlo, r1xhi, r2xlo, r2xhi, oxlo, oxhi, etag, status, NO_PAR_CHECK = no_par_check
; Description: This module determines the overlap range between two index ranges in one dimension.
; The first index range is defined by "[r1xlo:r1xhi]" and the second index range is
; defined by "[r2xlo:r2xhi]". The overlap range is defined by "[oxlo:oxhi]". If the
; overlap range is non-empty then "etag" is returned with a value of "1", otherwise
; "etag" is returned with a value of "0".
;
; Input Parameters:
;
; r1xlo - INTEGER/LONG - The x index/pixel number of the lower bound of the first range.
; r1xhi - INTEGER/LONG - The x index/pixel number of the upper bound of the first range. This
; parameter must have a value that is greater than or equal to the value
; of the parameter "r1xlo".
; r2xlo - INTEGER/LONG - The x index/pixel number of the lower bound of the second range.
; r2xhi - INTEGER/LONG - The x index/pixel number of the upper bound of the second range. This
; parameter must have a value that is greater than or equal to the value
; of the parameter "r2xlo".
;
; Output Parameters:
;
; oxlo - LONG - The x index/pixel number of the lower bound of the overlap range. This parameter
; is returned with a value of "0" if the overlap range is empty.
; oxhi - LONG - The x index/pixel number of the upper bound of the overlap range. This parameter
; is returned with a value of "0" if the overlap range is empty.
; etag - LONG - This parameter is returned with a value of "1" if the overlap range is non-empty,
; and it is returned with a value of "0" if the overlap range is empty.
; status - INTEGER - If the module successfully determined the overlap range, then "status" is
; returned with a value of "1", otherwise it is returned with a value of "0".
;
; Keywords:
;
; If the keyword NO_PAR_CHECK is set (as "/NO_PAR_CHECK"), then the module will not perform
; parameter checking on the input parameters, reducing module overheads.
;
; Author: Dan Bramich (dan.bramich@hotmail.co.uk)
;
; History:
;
; 19/11/2010 - Module created (dmb).
;Set the default output parameters
;Perform parameter checking if not instructed otherwise
;Check that the input parameters are numbers of the correct type
;Calculate the length of each range
;Check that the lengths of each range make sense
;Determine the overlap range
;If an overlap range exists
;Set "etag" to "1"
;If there is no overlap range, then return an empty overlap range
;Set "status" to "1"