[PR #261] [MERGED] feat: add real track geometry rendering to Track Position Map #257

Closed
opened 2026-05-07 00:19:26 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/261
Author: @4f4d
Created: 3/20/2026
Status: Merged
Merged: 4/17/2026
Merged by: @IAmTomShaw

Base: mainHead: feature/track-position-real-geometry


📝 Commits (6)

  • 9c59558 feat: add real track geometry rendering to Track Position Map
  • ab10d17 perf: send geometry periodically, fix rotation center
  • bd4b0ca Switch order of the buttons
  • 07a36bd fix: sync track position rendering with main window geometry projection
  • ad9311d Merge branch 'main' into feature/track-position-real-geometry
  • 320f417 Merge branch 'main' into feature/track-position-real-geometry

📊 Changes

3 files changed (+410 additions, -82 deletions)

View changed files

📝 src/gui/insights_menu.py (+1 -1)
📝 src/insights/track_position_window.py (+390 -79)
📝 src/interfaces/race_replay.py (+19 -2)

📄 Description

Closes #260

Summary

Adds real circuit layout rendering to the Track Position Map insight window. Users can switch between the actual track shape and the original circular schematic via toggle buttons.

Changes

race_replay.py

  • Attach inner/outer track edge coordinates to the telemetry payload
  • Geometry sent every 120 frames (~5s) to avoid payload bloat — clients process it once

track_position_window.py

  • Real-track mode: filled road surface polygon, edge lines, dashed centre line, S/F marker
  • Driver positioning via binary search on cumulative centre-line distances
  • Rotation uses bounding-box midpoint to match the main window's coordinate system
  • Toggle buttons (Real Track / Circular) in the status bar
  • All original circular rendering code preserved

insights_menu.py

  • Updated description to reflect both view modes

Screenshots

Real Track View

Screenshot 2026-03-20 at 17 40 57

Circular Track View

Screenshot 2026-03-20 at 17 41 28

Toggle Buttons

Screenshot 2026-03-20 at 17 42 26

Insights Menu

Screenshot 2026-03-20 at 17 39 05

Design Decisions

  • Periodic geometry (not every frame): The geometry payload is ~42 KB of static data. Sending it every frame would add ~22x to each message. Sending every 120 frames (~5s cadence) keeps overhead minimal while ensuring late-connecting clients receive it quickly. This means the real track view appears ~3–5s after the window opens while the circular view acts as a loading state until the first geometry payload arrives.
  • Rotation centre: Uses (min+max)/2 bounding-box midpoint, matching world_to_screen() in the Arcade window.
  • Preserved circular view: The original rendering serves a purpose (even spacing when drivers are bunched), so it's kept as a selectable option rather than replaced.

Testing

  • Syntax verified across all 3 files
  • Both rendering modes work and toggle instantly
  • No new dependencies (uses existing PySide6 imports)
  • Falls back to circular view if geometry isn't received

Note: commits authored under 0m99 — same person as 4f4d i.e., me


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/261 **Author:** [@4f4d](https://github.com/4f4d) **Created:** 3/20/2026 **Status:** ✅ Merged **Merged:** 4/17/2026 **Merged by:** [@IAmTomShaw](https://github.com/IAmTomShaw) **Base:** `main` ← **Head:** `feature/track-position-real-geometry` --- ### 📝 Commits (6) - [`9c59558`](https://github.com/IAmTomShaw/f1-race-replay/commit/9c5955863b376c9b38aff7cd79f89cb9a8aba565) feat: add real track geometry rendering to Track Position Map - [`ab10d17`](https://github.com/IAmTomShaw/f1-race-replay/commit/ab10d17b9d1bca77ebe0264963d79b87a5ccafd6) perf: send geometry periodically, fix rotation center - [`bd4b0ca`](https://github.com/IAmTomShaw/f1-race-replay/commit/bd4b0ca9690d567feb900784ee2628e2437b1156) Switch order of the buttons - [`07a36bd`](https://github.com/IAmTomShaw/f1-race-replay/commit/07a36bda8e52acf4eb488e18f31e810c174b96f5) fix: sync track position rendering with main window geometry projection - [`ad9311d`](https://github.com/IAmTomShaw/f1-race-replay/commit/ad9311dfad77341f22bd500fff5a399fd8f13092) Merge branch 'main' into feature/track-position-real-geometry - [`320f417`](https://github.com/IAmTomShaw/f1-race-replay/commit/320f41759f69a4721def975f5523bb79081b39b9) Merge branch 'main' into feature/track-position-real-geometry ### 📊 Changes **3 files changed** (+410 additions, -82 deletions) <details> <summary>View changed files</summary> 📝 `src/gui/insights_menu.py` (+1 -1) 📝 `src/insights/track_position_window.py` (+390 -79) 📝 `src/interfaces/race_replay.py` (+19 -2) </details> ### 📄 Description Closes #260 ## Summary Adds real circuit layout rendering to the Track Position Map insight window. Users can switch between the actual track shape and the original circular schematic via toggle buttons. ## Changes ### `race_replay.py` - Attach inner/outer track edge coordinates to the telemetry payload - Geometry sent every 120 frames (~5s) to avoid payload bloat — clients process it once ### `track_position_window.py` - Real-track mode: filled road surface polygon, edge lines, dashed centre line, S/F marker - Driver positioning via binary search on cumulative centre-line distances - Rotation uses bounding-box midpoint to match the main window's coordinate system - Toggle buttons (`Real Track` / `Circular`) in the status bar - All original circular rendering code preserved ### `insights_menu.py` - Updated description to reflect both view modes ## Screenshots #### Real Track View <img width="1470" height="920" alt="Screenshot 2026-03-20 at 17 40 57" src="https://github.com/user-attachments/assets/f0b30275-9bfd-462c-8837-ab5d96bd5a34" /> #### Circular Track View <img width="1470" height="919" alt="Screenshot 2026-03-20 at 17 41 28" src="https://github.com/user-attachments/assets/9dbc3bc7-d875-4e31-8580-a89e2d3a0fd1" /> #### Toggle Buttons <img width="581" height="81" alt="Screenshot 2026-03-20 at 17 42 26" src="https://github.com/user-attachments/assets/acd6f247-a399-4f7d-96eb-82aff033a90d" /> #### Insights Menu <img width="301" height="627" alt="Screenshot 2026-03-20 at 17 39 05" src="https://github.com/user-attachments/assets/aedd0842-d54b-4b51-819f-7ed91f259608" /> ## Design Decisions - **Periodic geometry (not every frame):** The geometry payload is ~42 KB of static data. Sending it every frame would add ~22x to each message. Sending every 120 frames (~5s cadence) keeps overhead minimal while ensuring late-connecting clients receive it quickly. **This means the real track view appears ~3–5s after the window opens while the circular view acts as a loading state until the first geometry payload arrives.** - **Rotation centre:** Uses `(min+max)/2` bounding-box midpoint, matching `world_to_screen()` in the Arcade window. - **Preserved circular view:** The original rendering serves a purpose (even spacing when drivers are bunched), so it's kept as a selectable option rather than replaced. ## Testing - Syntax verified across all 3 files - Both rendering modes work and toggle instantly - No new dependencies (uses existing PySide6 imports) - Falls back to circular view if geometry isn't received Note: commits authored under 0m99 — same person as 4f4d i.e., me --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#257
No description provided.