Begin statistics creation

This commit is contained in:
Christoph Hagen
2025-08-31 16:27:32 +02:00
parent f972a2c020
commit 96bd07bdb7
33 changed files with 1406 additions and 187 deletions

View File

@@ -0,0 +1,32 @@
struct RouteProfile: Codable {
let min: Double
let max: Double
let ticks: Int
let span: Double
let scale: Double
init(min: Double, max: Double, ticks: Int) {
self.min = min
self.max = max
self.ticks = ticks
self.span = max - min
self.scale = 1 / span
}
func scale(_ value: Double) -> Double {
if value < min {
return 0
}
if value > max {
return 1
}
return (value - min) / span
}
}