mhhh - might be I am totally wrong with my calculations... but I thought the algorithm is not that complicated - allow me to explain, how these values will be generated:
Assuming we have 4 points recorded:
P1: alt 10m
P2: alt 20m
P3: alt 40m
P4: alt 30m
what the code does:
// init...
altGaind = 0
altLost = 0
//iterate though all points
P2-P1 = +10
altGaind = 10
P3-P2 = +20
altGaind = 30
P4-P3 = -10
altLost = 10
do you agree, that this approach is the right one? (comparing current Point with previous point - calculating the difference and ig it's positive, that we add this difference to the "altGaind" value, if it was negative we add the absolute value to altLost)...
so assuming we have recorded 1000 points like this
P0001: alt = 1m
P0002: alt = 2m
P0003: alt = 1m
P0004: alt = 2m
P0005: alt = 1m
...
P0999: alt = 1m
P1000: alt = 2m
what would be the altGaind value? -> 500 is that correct? (altLost = 499)...
I would just like to confirm, that I have understood your expectations concerning the altGain value calculation correctly.
Thanks for your feedback! |