Skip to content
Snippets Groups Projects
Commit 24b99933 authored by Marc-Philipp Knechtle's avatar Marc-Philipp Knechtle
Browse files

add get_intersecting_cells

parent abcc4248
Branches
No related tags found
No related merge requests found
from docrecjson.elements import Cell
from typing import List
from shapely import geometry as shapely
def get_intersecting_cells(cell: Cell, cells: List[Cell]) -> List[Cell]:
"""
:param: cell: cell which the intersection is performed on
:param: cells: list of cells to check for the intersection
:return: every cell which intersects the original cell
"""
p_1_area: shapely.Polygon = shapely.Polygon(cell.bounding_box.polygon)
intersecting_cells: list = []
for compare_cell in cells:
p_2_area: shapely.Polygon = shapely.Polygon(compare_cell.bounding_box.polygon)
if p_1_area.intersects(p_2_area):
intersecting_cells.append(compare_cell)
return intersecting_cells
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment