I'm looking at the problem of drawing labels on a graph, e.g street names, which might overlap.
What I want, so I don't have to write it myself, is a module which takes 2 rectangles defined by their corners, and gives me a Boolean result as to whether or not the 2 rectangles overlap.
I don't want to be tied to any particular image processing software, e.g. Image::Magick, and I don't need the result to be the polygon defined by the overlap.
I can see an algorithm: Take the 2 end lines [*] of one rectangle, determine their equations, and see if they intersect any of the sides of the other rectangle. Then reverse the roles of the 2 rectangles to check the opposite case.
[*] For 2 lines meeting at the corner, it doesn't matter which of the 2 lines is used. So 2 bounding lines of a rectangle which don't meet ought to be sufficient.
Has this been done?
Are there any modules which do part of it?
I searched CPAN for Math::*, but did not see anything obviously relevant.