Preserve offline geometry, marking, replay and evaluation pipelines with source manifests and synthetic tests. Research qualification does not activate these methods as production navigation.
15 lines
542 B
Python
15 lines
542 B
Python
"""Transform complete catalog geometry and its probes through the same frame."""
|
|
import numpy as np
|
|
from shapely.ops import transform
|
|
|
|
def points_in_frame(points,matrix):
|
|
h=np.asarray(matrix,float);xy=np.asarray(points,float)
|
|
p=np.c_[xy[:,:2],np.ones(len(xy))]@h.T
|
|
if np.any(abs(p[:,2])<1e-8):raise ValueError('Singular glyph frame')
|
|
return p[:,:2]/p[:,2,None]
|
|
|
|
def geometry_in_frame(geometry,matrix):
|
|
def fn(x,y,z=None):
|
|
p=points_in_frame(np.c_[x,y],matrix);return p[:,0],p[:,1]
|
|
return transform(fn,geometry)
|