PRO region_overlap_2d, r1xlo, r1xhi, r1ylo, r1yhi, r2xlo, r2xhi, r2ylo, r2yhi, oxlo, oxhi, oylo, oyhi, status
; Description: This module determines the overlap region between two rectangular regions in two dimensions.
; The first region is defined by "[r1xlo:r1xhi,r1ylo:r1yhi]" and the second region is
; defined by "[r2xlo:r2xhi,r2ylo:r2yhi]". The overlap region is defined by
; "[oxlo:oxhi,oylo:oyhi]". If the overlap region 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 bottom left hand corner of the first region.
; r1xhi - INTEGER/LONG - The x index/pixel number of the top right hand corner of the first 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 region.
; r1yhi - INTEGER/LONG - The y index/pixel number of the top right hand corner of the first 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 region.
; r2xhi - INTEGER/LONG - The x index/pixel number of the top right hand corner of the second 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 region.
; r2yhi - INTEGER/LONG - The y index/pixel number of the top right hand corner of the second 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.
; status - INTEGER - 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.
;
; 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 size of each region
;If the sizes of either region are not sensible, then return with an empty overlap region
;Determine the overlap region
;If an overlap region exists, then set the value of "status" to "1"
;If there is no overlap region, then set the value of "status" to "0" and return an empty overlap region