From 5e3d39cda5250cb55bc8324bcf96b0ab4b36c47f Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Fri, 21 Aug 2026 15:30:51 +0200 Subject: 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 --- ride/difficulty_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ride/difficulty_test.go') diff --git a/ride/difficulty_test.go b/ride/difficulty_test.go index 5773376..05b60f9 100644 --- a/ride/difficulty_test.go +++ b/ride/difficulty_test.go @@ -44,7 +44,7 @@ func TestCotacolExampleRide(t *testing.T) { func TestCotacolClimbNotAtStart(t *testing.T) { r := RideBuilder{precision: 100}.WithSection("1km at 0%").WithSection("2km at 7%").Build() - climbs := r.AllClimbs() + climbs := r.DetectClimbs(nil) assert.Len(t, climbs, 1) assert.InDelta(t, 98.0, climbs[0].DifficultyScore(), 1e-9) } @@ -78,7 +78,7 @@ func TestCategoryOfBoundaries(t *testing.T) { func TestCotacolHautacamClimbfinderReference(t *testing.T) { r, err := ride.ParseFile(parser, "../examples/2022-07-21.Pogacar.gpx") assert.NoError(t, err) - climbs := r.AllClimbs() + climbs := r.DetectClimbs(nil) assert.Len(t, climbs, 6) hautacam := climbs[5] assert.InDelta(t, 128.6, hautacam.StartDistanceM()/1000, 0.1) -- cgit v1.3