
Store







CTK Exchange
Conan K Woods (Guest)
guest

Jan0101, 07:11 PM (EST) 

"Two rectangles, do they intersect?"

Hi, I have a math problem I have to solve for a computer program I am writing. I have two rectangles, and I need an algorithm to see if at any point the two rectangles intersect. I have the x and y values of all the points of each rectangle. Is their a fast and easy way to do this? woodsc@f00f.net 

Alert  IP 
Printerfriendly page  Edit 
Reply 
Reply With Quote  Top 


alexb
Charter Member
672 posts 
Jan0101, 07:16 PM (EST) 

1. "RE: Two rectangles, do they intersect?"
In response to message #0

Assume you want to establish whether two infinite horizontal strips intersect or not. What would you do? Assume for one of them a <= y <= a + A, for the other b <= y <= b + B. When do they intersect? A similar question for a couple of infinite strips is solved analogously. Now note that every rectangle is an intersection of two infinite strips: one horizontal, the other vertical. 

Alert  IP 
Printerfriendly page  Edit 
Reply 
Reply With Quote  Top 


You may be curious to visit the old CTK Exchange archive.
Front page
Contents
Copyright © 19962018 Alexander Bogomolny
[an error occurred while processing this directive]

Advertise
