API#
- curve_matcher.shape_similarity(curve1, curve2, estimation_points=50, rotations=10, restrict_rotation_angle=3.141592653589793, check_rotations=True)[source]#
- Return type:
float
- curve_matcher.find_procrustes_rotation_angle(curve, relative_curve)[source]#
Find the angle to rotate curve to match the rotation of relativeCurve using procrustes analysis from https://en.wikipedia.org/wiki/Procrustes_analysis
curve and relativeCurve must have the same number of points curve and relativeCurve should both be run through procrustes_normalize_curve first
- Return type:
float
- curve_matcher.procrustes_normalize_curve(curve, rebalance=True, estimation_points=50)[source]#
Translate and scale curve by Procrustes Analysis Optionally runs rebalance_curve first (default True) from https://en.wikipedia.org/wiki/Procrustes_analysis
- Return type:
list
[Point
]
- curve_matcher.procrustes_normalize_rotation(curve, relative_curve)[source]#
Rotate curve to match the rotation of relativeCurve using procrustes analysis from https://en.wikipedia.org/wiki/Procrustes_analysis
curve and relativeCurve must have the same number of points curve and relativeCurve should both be run through procrustes_normalize_curve first
- Return type:
list
[Point
]
- curve_matcher.extend_point_on_line(p1, p2, dist)[source]#
return a new point, p3, which is on the same line as p1 and p2, but <dist> away from p2 p1, p2, p3 will always lie on the line in that order (as long as dist is positive)
- Return type:
- curve_matcher.point_distance(point1, point2)[source]#
Calculate the distance between 2 points
- Return type:
float
- curve_matcher.rebalance_curve(curve, num_points=50)[source]#
Redraw the curve using num_points points equally spaced along the length of the curve This may result in a slightly different shape than the original if num_points is low
- Return type:
list
[Point
]