AngularAligner
Angular alignment based on centroid positions
Uses angular alignment based on vertex positions relative to centroids. Rotates the second vertex list to minimize total angular distance. Best for closed ā closed shape morphing. Algorithm: 1. Apply shape rotations to both vertex lists 2. Calculate centroids for each shape 3. Compute angular positions of each vertex relative to its centroid 4. Try all possible vertex offset rotations 5. Select offset that minimizes total angular distance (using specified norm) 6. Return original vertices with selected offset applied to verts2 Performance: O(n²) - tries n offsets, evaluates n vertices each
Constructor
AngularAligner(
norm: Union[str, AlignmentNorm, AngularDistanceFn] = <AlignmentNorm.L1: 'l1'>
)
Initialize angular aligner with distance norm.
Parameters
-
norm - Distance metric for alignment - "l1" or AlignmentNorm.L1: Sum of angular differences (default) - "l2" or AlignmentNorm.L2: Root mean square angular distance - "linf" or AlignmentNorm.LINF: Maximum angular difference - Callable: Custom distance function(angles1, angles2, offset) -> float
Methods
align
align(
verts1: Points2D,
verts2: Points2D,
context: AlignmentContext,
rotation_target: Optional[float] = None
) -> Tuple[Points2D, Points2D]