def do_segments_cross(segment_ab, segment_cd):
    """Return whether two segments cross each other."""
    ### name points

    a, b = segment_ab
    c, d = segment_cd

    ### return whether segments cross each other based on
    ### the orientation of each different triplet between
    ### the four points

    return ccw(a, b, c) != ccw(a, b, d) and ccw(c, d, a) != ccw(c, d, b)
Return whether two segments cross each other.
nodezator/graphman/socketparenthood/utils.py