mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
3d02d863f9
The relative neighborhood graph (RNG) is a subgraph of the Delaunay triangulation, so only Delaunay edges are candidates for RNG membership. The previous implementation tested all N^2 pairs against all N points, giving O(N^3). The new implementation builds the Delaunay triangulation with Subdiv2D (O(N log N)), then checks only those ~3N edges for the RNG lune-emptiness condition, reducing computeRNG to O(N^2) in the worst case and much better in practice for regular grids. Added synthetic-grid accuracy tests for both symmetric and asymmetric patterns across several sizes, and a perf test parameterized by grid size.