mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(traffic): keep a TomTom side from pairing with its own pieces
A one_side line that doubles back within 5 m of itself, such as a turnaround drawn as one line, matched its own return leg and took a two-way half share with no partner. Flow index pieces now carry their source line, and a radiusFor of 0 leaves a piece out of nearest(), so pairing skips the line's own pieces. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
1cd4dde26d
commit
9caa0947b6
3 files changed
+14
-3
No files matched your search
@@ -139,6 +139,7 @@ export function createFlowSegmentIndex(flowSegments) {
|
||||
roadType,
|
||||
level,
|
||||
closure,
|
||||
flow,
|
||||
};
|
||||
const key = cellKey(
|
||||
Math.floor((seg.ax + seg.bx) / 2 / CELL_SIZE_M),
|
||||
@@ -158,7 +159,8 @@ export function createFlowSegmentIndex(flowSegments) {
|
||||
const radius2 = MATCH_RADIUS_M * MATCH_RADIUS_M;
|
||||
/**
|
||||
* Nearest direction-compatible segment within 35 m of a projected point.
|
||||
* `radiusFor(segment)` may tighten the radius per segment (never widen it).
|
||||
* `radiusFor(segment)` may tighten the radius per segment (never widen it);
|
||||
* 0 leaves the segment out.
|
||||
*/
|
||||
function nearest(px, py, bearing, radiusFor = null) {
|
||||
const cx = Math.floor(px / CELL_SIZE_M);
|
||||
@@ -177,7 +179,7 @@ export function createFlowSegmentIndex(flowSegments) {
|
||||
candidate = true; // within radius, bearing not yet checked
|
||||
if (radiusFor) {
|
||||
const radius = Math.min(MATCH_RADIUS_M, radiusFor(seg));
|
||||
if (d2 > radius * radius) continue;
|
||||
if (!(radius > 0) || d2 > radius * radius) continue;
|
||||
}
|
||||
const diff = bearingDiffDeg(seg.bearing, bearing);
|
||||
if (
|
||||
|
||||
Reference in new issue
Block a user