I need some help with this problem that I just cant seen to understand how to do.
I just need help coming up with an algorithm that can check to see if two parallelograms have an intersection. This involves where they are on a 2d grid (x,y) coordinates of the vertex's.
The other thing is the grid I am working with, the (0,0) or origin is at the top left
and as you go down, the y number is increasing and is >= 0
An example is:
If you know can you write out the steps to solve it ex. [find of the length of this, then subtract this from this, etc...]
given 16 arguments
the (x,y)#1 will be the top_left of the parallelogram
the (x,y)#2 will be the top_right of the parallelogram
the (x,y)#3 will be the bottom_left of the parallelogram
the (x,y)#4 will be the bottom_right of the parallelogram
NOTE: the parallelogram may be a rectangle
NOTE2: I am working with variables here, not actual values.
NOTE3: there are no negative x or y coordinates in the grid. its just [for x] 0,...,room_width, and [for y] 0,...,room_height. This is the whole grid.
With this data, how do I find out if there is an intersection anywhere between both the parallelograms? One of them doesn't have to lie directly inside the other, I just want to know if they touch.
Any help is appreciated.