Deep Learning - SG segmentation/FCN-DenseNet inference/lineintersect.py
def doBoundingBoxesIntersect(a, b, c, d):
    '''
    Check if bounding boxes do intersect. If one bounding box touches
    the other, they do intersect.
    First segment is of points a and b, second of c and d.
    '''
    ll1_x = min(a[0],b[0]); ll2_x = min(c[0],d[0])
    ll1_y = min(a[1],b[1]); ll2_y = min(c[1],d[1])
    ur1_x = max(a[0],b[0]); ur2_x = max(c[0],d[0])
    ur1_y = max(a[1],b[1]); ur2_y = max(c[1],d[1])

    return ll1_x <= ur2_x and \
           ur1_x >= ll2_x and \
           ll1_y <= ur2_y and \
           ur1_y >= ll2_y

    Check if bounding boxes do intersect. If one bounding box touches
    the other, they do intersect.
    First segment is of points a and b, second of c and d.
    
Check if bounding boxes do intersect. If one bounding box touches
the other, they do intersect.
First segment is of points a and b, second of c and d.
Check if bounding boxes do intersect . If one bounding box touches the other they do intersect . First segment is of points a and b second of c and d .
def doBoundingBoxesIntersect(a, b, c, d):
    ll1_x = min(a[0],b[0]); ll2_x = min(c[0],d[0])
    ll1_y = min(a[1],b[1]); ll2_y = min(c[1],d[1])
    ur1_x = max(a[0],b[0]); ur2_x = max(c[0],d[0])
    ur1_y = max(a[1],b[1]); ur2_y = max(c[1],d[1])
    return ll1_x <= ur2_x and \
           ur1_x >= ll2_x and \
           ll1_y <= ur2_y and \
           ur1_y >= ll2_y
def doBoundingBoxesIntersect ( a , b , c , d ) : ll1_x = min ( a [ 0 ] , b [ 0 ] ) ; ll2_x = min ( c [ 0 ] , d [ 0 ] ) ll1_y = min ( a [ 1 ] , b [ 1 ] ) ; ll2_y = min ( c [ 1 ] , d [ 1 ] ) ur1_x = max ( a [ 0 ] , b [ 0 ] ) ; ur2_x = max ( c [ 0 ] , d [ 0 ] ) ur1_y = max ( a [ 1 ] , b [ 1 ] ) ; ur2_y = max ( c [ 1 ] , d [ 1 ] ) return ll1_x <= ur2_x and ur1_x >= ll2_x and ll1_y <= ur2_y and ur1_y >= ll2_y
Check if bounding boxes do intersect.
Check if bounding boxes do intersect .
'''
    Check if bounding boxes do intersect. If one bounding box touches
    the other, they do intersect.
    First segment is of points a and b, second of c and d.
    '''
a
b
c
d