intersection of hyper-rectangles

Hi,If I define two hyper-rectanges in n-dimentional space by specifying their coordinates of lower-left corner and upeer-right corner, how can I determine if these two recs intersect with each other?Any hint appreciated!Thanks.
[255 byte] By [cunfua] at [2007-10-2 13:56:10]
# 1
My alrorithm is :for the two lower corners, check equality for each dimension, if any of these two numbers equal, then they intersect. if none of these are equal, do the check on the pair of the upper corners.Is this making any sence?thanks
cunfua at 2007-7-13 12:00:08 > top of Java-index,Other Topics,Algorithms...
# 2

If two h-rects intersect, there must be at least one point that is in that intersection and thus is in the interior of each one.

To be in the interior of an h-rect means that you have a point, p, where the value of each coordinate landed in the range between the UpperLeft and the LowerRight for that coordinate.

So to get a point in the intersection, for each coordinate, the intersection point must have a value that is simultaneously in the range for the first h-rect as well as for the second h-rect.

This means that the two h-rects must have overlapping ranges in every single coordinate.

So if the two h-rects have an overlapping range in every single coordinate then they intersect, otherwise they do not.

marlin314a at 2007-7-13 12:00:08 > top of Java-index,Other Topics,Algorithms...