def test_rotations(contour_with_point: Tuple[Contour, Point]) -> None: contour, point = contour_with_point result = point_in_contour(point, contour) assert all(result is point_in_contour(point, rotated) for rotated in contour_rotations(contour))
def test_reversals(contour_with_point: Tuple[Contour, Point]) -> None: contour, point = contour_with_point result = point_in_contour(point, contour) assert result is point_in_contour(point, reverse_contour(contour)) assert result is point_in_contour(reverse_point_coordinates(point), reverse_contour_coordinates(contour))
def test_connection_with_point_in_contour( contour_with_segment: Tuple[Contour, Segment]) -> None: contour, segment = contour_with_segment result = segment_in_contour(segment, contour) assert implication( result is Relation.DISJOINT, point_in_contour(segment.start, contour) is point_in_contour( segment.end, contour) is Location.EXTERIOR)
def test_basic(contour_with_point: Tuple[Contour, Point]) -> None: contour, point = contour_with_point result = point_in_contour(point, contour) assert isinstance(result, Location) assert result in LINEAR_LOCATIONS
def test_connection_with_point_in_contour( contours_pair: Tuple[Contour, Contour]) -> None: left_contour, right_contour = contours_pair assert implication( contour_in_contour(left_contour, right_contour) in (Relation.EQUAL, Relation.COMPONENT), all( point_in_contour(vertex, right_contour) is Location.BOUNDARY for vertex in left_contour.vertices))
def test_self(contour: Contour) -> None: assert all( point_in_contour(vertex, contour) is Location.BOUNDARY for vertex in contour.vertices)