Skip to main content

merge_corners_simple

Function merge_corners_simple 

Source
pub fn merge_corners_simple(
    corners: &mut Vec<Corner>,
    radius: f32,
) -> Vec<Corner>
Expand description

Merge corners within a given radius, keeping the strongest response.

Uses a uniform spatial grid with cell size equal to radius, so any two corners within radius of each other land in the same or neighbouring cells. For N input corners the expected cost is O(N) with small constants (vs the naive O(N²) pairwise scan), which matters on Radon-detected frames where N can run into the thousands.

The output is order-equivalent to the naive scan: when an incoming corner is within radius of multiple existing corners, the first-seen existing corner wins the merge — same as the previous implementation. When the incoming corner is stronger, it replaces that existing corner’s position in-place.