PRO determine_rectangle_overlap_2d, r1xlo, r1xhi, r1ylo, r1yhi, r2xlo, r2xhi, r2ylo, r2yhi, oxlo, oxhi, oylo, oyhi, etag, status, NO_PAR_CHECK = no_par_check
; Description: This module determines the overlap region between two rectangular regions in two dimensions.
; The first rectangular region is defined by "[r1xlo:r1xhi,r1ylo:r1yhi]" and the second
; rectangular region is defined by "[r2xlo:r2xhi,r2ylo:r2yhi]". The overlap region, which is
; also a rectangle, is defined by "[oxlo:oxhi,oylo:oyhi]". If the overlap region 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 bottom left hand corner of the first rectangular
; region.
; r1xhi - INTEGER/LONG - The x index/pixel number of the top right hand corner of the first rectangular
; region. This parameter must have a value that is greater than or equal to the
; value of the parameter "r1xlo".
; r1ylo - INTEGER/LONG - The y index/pixel number of the bottom left hand corner of the first rectangular
; region.
; r1yhi - INTEGER/LONG - The y index/pixel number of the top right hand corner of the first rectangular
; region. This parameter must have a value that is greater than or equal to the
; value of the parameter "r1ylo".
; r2xlo - INTEGER/LONG - The x index/pixel number of the bottom left hand corner of the second rectangular
; region.
; r2xhi - INTEGER/LONG - The x index/pixel number of the top right hand corner of the second rectangular
; region. This parameter must have a value that is greater than or equal to the
; value of the parameter "r2xlo".
; r2ylo - INTEGER/LONG - The y index/pixel number of the bottom left hand corner of the second rectangular
; region.
; r2yhi - INTEGER/LONG - The y index/pixel number of the top right hand corner of the second rectangular
; region. This parameter must have a value that is greater than or equal to the
; value of the parameter "r2ylo".
;
; Output Parameters:
;
; oxlo - LONG - The x index/pixel number of the bottom left hand corner of the overlap region. This
; parameter is returned with a value of "0" if the overlap region is empty.
; oxhi - LONG - The x index/pixel number of the top right hand corner of the overlap region. This
; parameter is returned with a value of "0" if the overlap region is empty.
; oylo - LONG - The y index/pixel number of the bottom left hand corner of the overlap region. This
; parameter is returned with a value of "0" if the overlap region is empty.
; oyhi - LONG - The y index/pixel number of the top right hand corner of the overlap region. This
; parameter is returned with a value of "0" if the overlap region is empty.
; etag - LONG - This parameter is returned with a value of "1" if the overlap region is non-empty, and it
; is returned with a value of "0" if the overlap region is empty.
; status - INTEGER - If the module successfully determined the overlap region, 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 parameter values
;Perform parameter checking if not instructed otherwise
;Check that the input parameters are numbers of the correct type
;Calculate the size of each rectangular region
;Check that the sizes of each rectangular region make sense
;Determine the overlap region
;If an overlap region exists
;Set "etag" to "1"
;If there is no overlap region, then return an empty overlap region
;Set "status" to "1"