Symptom
In the Globe view with Smooth Trails on, satellite ground tracks appear to spiral rather than trace repeating orbital arcs. The effect becomes obvious once the time-window filter is long enough to include multiple passes — reportedly visible at ~2h windows and worse at 24h / 7d.
With smoothing off, the same data renders as the expected orbit-like arcs (with visible 1° NMEA quantization, but no spiral).
Suspected area
Smoothing is applied per-pass in `SatPass.groundTrackPoints` via `smoothedAzEl`, called from `SkyGlobeView.swift:350`:
```swift
let samples = pass.groundTrackPoints(observerLat: lat, observerLon: lon,
maxPoints: .max,
smoothingWindow: smoothTrails ? 0 : 1)
```
`smoothedAzEl` is a two-pass centered moving average on (az, el), with az unwrapped across the 0°/360° seam. Output is re-wrapped via `truncatingRemainder(dividingBy: 360)`.
Candidate causes to investigate:
- Edge bias from the centered window — near the start/end of an observation array the window is truncated (`max(0, i-half)…min(n-1, i+half)`), which pulls endpoints toward the interior. For partial passes this could systematically bend the start/end of each ground track.
- Az unwrap / re-wrap interaction with the projection — if the unwrapped azimuth accumulates across a 360° cycle (e.g. for a near-zenith pass) and the average lands in a non-canonical range, the re-wrap + projection may land the sub-sat point on a shifted longitude.
- Adaptive window size scaling with pass length — `adaptiveSmoothingWindow` widens to 11 taps on long passes. A wider window amplifies any endpoint bias, which could explain why the spiral grows with longer time-window filters (older = longer-recorded passes).
- Decimation after smoothing — unlikely given `maxPoints: .max` is used on the globe, but worth ruling out.
Repro
- Run PCC with GPS fix acquired, recording enabled.
- Leave it running for 2h+ to accumulate multiple passes.
- Globe view → time window ≥ 2h → Smooth Trails on.
- Observe ground tracks spiralling rather than repeating.
- Toggle Smooth Trails off → spiral disappears (trails become jagged but orbit-shaped).
Fix direction (TBD)
Probably one of:
- Use a symmetric reflection / repeat-edge strategy at the endpoints of `smoothedAzEl` so truncated windows don't bias the output.
- Or: don't smooth the first/last few samples at all and let the raw values bracket each pass.
Related
- The Map view shares the same `groundTrackPoints` code path and may show the same artefact — worth confirming.
- The polar view doesn't use smoothing at all (`SkyView.swift:524`) so it's unaffected, but its toolbar toggle is still wired to the same global setting — minor UX inconsistency to address separately.
Symptom
In the Globe view with Smooth Trails on, satellite ground tracks appear to spiral rather than trace repeating orbital arcs. The effect becomes obvious once the time-window filter is long enough to include multiple passes — reportedly visible at ~2h windows and worse at 24h / 7d.
With smoothing off, the same data renders as the expected orbit-like arcs (with visible 1° NMEA quantization, but no spiral).
Suspected area
Smoothing is applied per-pass in `SatPass.groundTrackPoints` via `smoothedAzEl`, called from `SkyGlobeView.swift:350`:
```swift
let samples = pass.groundTrackPoints(observerLat: lat, observerLon: lon,
maxPoints: .max,
smoothingWindow: smoothTrails ? 0 : 1)
```
`smoothedAzEl` is a two-pass centered moving average on (az, el), with az unwrapped across the 0°/360° seam. Output is re-wrapped via `truncatingRemainder(dividingBy: 360)`.
Candidate causes to investigate:
Repro
Fix direction (TBD)
Probably one of:
Related