do2BBoxIntersect :: BBox -> BBox -> Bool  
do2BBoxIntersect (BBox (ulx1,uly1) (lrx1,lry1)) (BBox (ulx2,uly2) (lrx2,lry2)) 
    = p1 && p2
  where p1 =    ulx1 <= ulx2 && ulx2 <= lrx1 
             || ulx1 <= lrx2 && lrx2 <= lrx1
             || ulx2 <= ulx1 && ulx1 <= lrx2
             || ulx2 <= lrx1 && lrx1 <= lrx2
        p2 =    uly1 <= uly2 && uly2 <= lry1 
             || uly1 <= lry2 && lry2 <= lry1 
             || uly2 <= uly1 && uly1 <= lry2 
             || uly2 <= lry1 && lry1 <= lry2
  
-- | is the second bbox inside the first bbox?
--   previously, hitTestInsideBBox
do2BBoxIntersect :: BBox -> BBox -> Bool
do2BBoxIntersect (BBox (ulx1,uly1) (lrx1,lry1)) (BBox (ulx2,uly2) (lrx2,lry2)) 
    = p1 && p2
  where p1 =    ulx1 <= ulx2 && ulx2 <= lrx1 
             || ulx1 <= lrx2 && lrx2 <= lrx1
             || ulx2 <= ulx1 && ulx1 <= lrx2
             || ulx2 <= lrx1 && lrx1 <= lrx2
        p2 =    uly1 <= uly2 && uly2 <= lry1 
             || uly1 <= lry2 && lry2 <= lry1 
             || uly2 <= uly1 && uly1 <= lry2 
             || uly2 <= lry1 && lry1 <= lry2
  
-- | is the second bbox inside the first bbox?
--   previously, hitTestInsideBBox
do2BBoxIntersect (BBox (ulx1,uly1) (lrx1,lry1)) (BBox (ulx2,uly2) (lrx2,lry2)) 
    = p1 && p2
  where p1 =    ulx1 <= ulx2 && ulx2 <= lrx1 
             || ulx1 <= lrx2 && lrx2 <= lrx1
             || ulx2 <= ulx1 && ulx1 <= lrx2
             || ulx2 <= lrx1 && lrx1 <= lrx2
        p2 =    uly1 <= uly2 && uly2 <= lry1 
             || uly1 <= lry2 && lry2 <= lry1 
             || uly2 <= uly1 && uly1 <= lry2 
             || uly2 <= lry1 && lry1 <= lry2
  
-- | is the second bbox inside the first bbox?
--   previously, hitTestInsideBBox