verse.utils.utils.distance_to_rect

verse.utils.utils.distance_to_rect(line: Tuple[ndarray, ndarray], rect: List[ndarray])

Compute the intersection between a line segment and a rectangle.

See https://math.stackexchange.com/a/2788041. :param line: a line segment [R, Q] :param rect: a rectangle [A, B, C, D] :return: the distance between R and the intersection of the segment RQ with the rectangle ABCD