mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
ErgFile: fix distance precision issues (#3435)
When parsing a "distance slope wind" type, a truncate to integers was done after computation to meters. This involved rounding issues that were accumulated, and were quite visible when such a file was used to synchronized with an RLV video (the slope changes happened "too early").
This commit is contained in:
@@ -620,7 +620,7 @@ void ErgFile::parseComputrainer(QString p)
|
||||
|
||||
// distance guff
|
||||
add.x = rdist;
|
||||
int distance = absoluteSlope.cap(1).toDouble() * 1000; // convert to meters
|
||||
double distance = absoluteSlope.cap(1).toDouble() * 1000.; // convert to meters
|
||||
|
||||
if (!bIsMetric) distance *= KM_PER_MILE;
|
||||
rdist += distance;
|
||||
@@ -628,7 +628,7 @@ void ErgFile::parseComputrainer(QString p)
|
||||
// gradient and altitude
|
||||
add.val = absoluteSlope.cap(2).toDouble();
|
||||
add.y = ralt;
|
||||
ralt += distance * add.val / 100; /* paused */
|
||||
ralt += distance * add.val / 100.; /* paused */
|
||||
|
||||
Points.append(add);
|
||||
if (add.y > MaxWatts) MaxWatts=add.y;
|
||||
|
||||
Reference in New Issue
Block a user