spatial: make nearest-segment queries sublinear for large networks#18
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef816914d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| match best { | ||
| Some((_, _, best_dist)) if dist < *best_dist => { | ||
| *best = Some((node_idx, projection, dist)); | ||
| } |
There was a problem hiding this comment.
Preserve input-order ties for identical segment geometry
On bidirectional roads we index two directed edges with the same geometry (src/routing/fetch.rs:297-300). This tree now keeps whichever segment it visits first when distances tie, instead of the old linear-scan/input-order tie-break, so snap_to_edge can map two points on the same physical road to opposite directed edges. route_edge_snapped treats edge direction as significant (src/routing/network.rs:343-370), so a simple 1 km two-way segment snapped at 0.2 and 0.8 now routes through the node and charges the full 1 km (or returns NoPath in the opposite order) instead of the expected 600 m same-edge result.
Useful? React with 👍 / 👎.
Summary
Validation
cargo fmt --all -- --checkcargo test spatial --libcargo clippy --workspace --all-targets -- -D warningscargo testFixes #5