def test_properties(boxes: List[Box], max_children: int) -> None: result = Tree(boxes, max_children=max_children) assert is_r_tree_valid(result) assert is_r_tree_balanced(result) assert to_r_tree_height(result) >= to_balanced_tree_height( len(boxes), max_children)
def _locate_point_in_indexed_polygons(tree: r.Tree, polygons: Sequence[Polygon], point: Point, context: Context) -> Location: candidates_indices = tree.find_supersets_indices( context.box_cls(point.x, point.x, point.y, point.y)) for candidate_index in candidates_indices: location = polygons[candidate_index].locate(point) if location is not Location.EXTERIOR: return location return Location.EXTERIOR
def test_base_boxes(tree: Tree) -> None: assert all(box in tree.find_subsets(box) for box in tree.boxes)
def test_basic(boxes: List[Box], max_children: int) -> None: result = Tree(boxes, max_children=max_children) assert result.boxes == boxes assert result.max_children == max_children
def test_base_boxes(tree: Tree) -> None: assert all((index, box) in tree.find_supersets_items(box) for index, box in enumerate(tree.boxes))
def test_base_boxes(tree: Tree) -> None: assert all(index in tree.find_subsets_indices(box) for index, box in enumerate(tree.boxes))