Amazon Kuiper Commercial Services compares reconstructed and reference point clouds from satellite and ground-based sensing pipelines. Given two point clouds, compute their symmetric squared Chamfer distance exactly.
For point clouds A and B, define:
CD(A, B) = 0.5 * (sum(min squared distance from a to B) / len(A) + sum(min squared distance from b to A) / len(B))
Implement chamfer_distance(points_a, points_b) and return the result as a floating-point number. The squared Euclidean distance between points is used, so do not take square roots. Your algorithm should avoid comparing every pair whenever possible.
def chamfer_distance(points_a, points_b):