aboutsummaryrefslogtreecommitdiff
path: root/ride/ride.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-21 15:30:51 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-21 15:30:51 +0200
commit5e3d39cda5250cb55bc8324bcf96b0ab4b36c47f (patch)
treef92fe6f938866688b994c99670e1e27863579255 /ride/ride.go
parent0e27097e3d706e0e5bd761bf35fe301fd119d2a9 (diff)
feat: bound climb detection by matched official climbs
Detected climbs no longer absorb an official climb's range: official climbs matched to the route by coordinates claim their stored start/end range, and climb detection now runs only in the free regions around them. On ride 263 a single absorbed Cat 2 ascent is split so creating a first-half official climb lets the second half be detected on its own. - ride: add Range, freeRegions, and DetectClimbs(claimed); exclude claimed ranges so a climb never overlaps one - official_climb: MatchClimb now bounds-matches purely by coordinates without needing a detected climb; extract geo.Nearest shared helper - rideanalysis: Analyze builds claimed climbs from matched official climbs and detects only in free regions; render official vs unmatched climbs separately
Diffstat (limited to 'ride/ride.go')
-rw-r--r--ride/ride.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/ride/ride.go b/ride/ride.go
index a10d8a2..d5533ae 100644
--- a/ride/ride.go
+++ b/ride/ride.go
@@ -22,7 +22,7 @@ var ErrNoTrackPoints = errors.New("ride has no track points")
type Ride struct {
distances []float64
elevations []float64
- coords []geodist.Coord
+ Coords []geodist.Coord
timestamps []time.Time
heartRates []float64
cadences []float64
@@ -32,7 +32,7 @@ type Ride struct {
func (r *Ride) check() {
kcore.Assert(r.Len() > 0, "no points in ride")
kcore.Assert(len(r.distances) == len(r.elevations), "ride columns have different lengths")
- kcore.Assert(len(r.distances) == len(r.coords), "ride columns have different lengths")
+ kcore.Assert(len(r.distances) == len(r.Coords), "ride columns have different lengths")
kcore.Assert(len(r.distances) == len(r.timestamps), "ride columns have different lengths")
for _, column := range [][]float64{r.heartRates, r.cadences, r.powers} {
if len(column) > 0 {
@@ -49,7 +49,7 @@ func (r Ride) DistanceM(i int) float64 { return r.distances[i] }
func (r Ride) ElevationM(i int) float64 { return r.elevations[i] }
-func (r Ride) Coord(i int) geodist.Coord { return r.coords[i] }
+func (r Ride) Coord(i int) geodist.Coord { return r.Coords[i] }
func (r Ride) Timestamp(i int) time.Time { return r.timestamps[i] }
@@ -171,7 +171,7 @@ func fromColumns(distances []float64, elevations []float64, coords []geodist.Coo
ride := Ride{
distances: distances,
elevations: elevations,
- coords: coords,
+ Coords: coords,
timestamps: timestamps,
heartRates: heartRates,
cadences: cadences,