Files
NODEDC_MISSION_CORE/simulation/urban-plan-research/replay/survey_grid.py
T
DCCONSTRUCTIONS 69dc566665 feat(research): preserve urban geometry pipelines and qualification suites
Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
2026-10-29 09:10:00 +03:00

18 lines
789 B
Python

"""Bound actual corridor tiles, not empty cells of its enclosing rectangle."""
import numpy as np
def corridor_cells(xy, origin, extent, *, step=40., radius=20., limit=256):
xy=np.asarray(xy,float)
if xy.ndim!=2 or xy.shape[1]!=2 or not len(xy) or not np.isfinite(xy).all():
raise ValueError('Invalid trajectory XY')
cells=[]
for ix in range(int(extent[0])):
for iy in range(int(extent[1])):
low=np.asarray(origin)+np.array([ix,iy])*step
distance=np.linalg.norm(np.maximum(np.maximum(low-xy,xy-low-step),0),axis=1)
if np.any(distance<=radius):
cells.append((ix,iy))
if len(cells)>limit:
raise ValueError('Pose corridor exceeds the 256-tile envelope')
return cells