PRO region_overlap_1d, r1xlo, r1xhi, r2xlo, r2xhi, oxlo, oxhi, status
; 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 "status" is returned with the value "1", otherwise
; "status" is returned with the value "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.
; status - INTEGER - 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.
;
; Author: Dan Bramich (dan.bramich@hotmail.co.uk)
;
; History:
;
; 18/08/2008 - Module created (dmb)
;Check that the input parameters are numbers of the correct type
;Calculate the length of each range
;If the lengths of either range are not sensible, then return with an empty overlap range
;Determine the overlap range
;If an overlap range exists, then set the value of "status" to "1"
;If there is no overlap range, then set the value of "status" to "0" and return an empty overlap range