diff options
author | Erich Eckner <git@eckner.net> | 2020-01-17 09:49:19 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-01-17 09:49:19 +0100 |
commit | d28fd4f87f16822bd39524a7dff810065efaf9f5 (patch) | |
tree | 2f49ca3e53673b67189030e707bf42ae234b259c | |
parent | 26c056cc6fabbff24db824ca6cdede106fc43217 (diff) | |
download | gpx-statistics-d28fd4f87f16822bd39524a7dff810065efaf9f5.tar.xz |
irgendwie fertig
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | statistics.pas | 54 |
3 files changed, 35 insertions, 25 deletions
@@ -1,2 +1,3 @@ lib statistics +werte.dat @@ -2,10 +2,11 @@ statistics: statistics.pas mkdir -p lib fpc -Mobjfpc -FUlib -Fu/usr/lib/fpc/src/packages/* -Fu../units "$<" -run: statistics +werte.dat: statistics gpx-to-tsv find ~/tmp/ -name '*.gpx' \ | sort \ | tr '\n' '\0' \ | xargs -0r cat \ | ./gpx-to-tsv \ - | ./statistics + | ./statistics \ + >"$@" diff --git a/statistics.pas b/statistics.pas index 525b353..0fc5d87 100644 --- a/statistics.pas +++ b/statistics.pas @@ -74,7 +74,7 @@ var ps: array[boolean] of tPosition; ws: array of tMesswert; minB,maxB,minL,maxL: extended; - zoom: extended; + zoom,w: extended; wL,wU,wBr,wHo: int64; anz: array of int64; sum,qSum: array of extended; @@ -82,7 +82,7 @@ var begin i:=0; ShortDateFormat:='y-m-d'; - zoom:=500; + zoom:=5000; for b:=false to true do ps[b]:=tPosition.create; setLength(ws,0); @@ -97,35 +97,43 @@ begin if i>0 then begin if ps[false].zeit<ps[true].zeit then writeln(stderr, 'ERROR: ' + ps[false].toString + ' < ' + ps[true].toString); - if ps[false].zeit-ps[true].zeit < 30 then begin - setLength(ws,length(ws)+1); - ws[length(ws)-1]:=tMesswert.create; - with ws[length(ws)-1] do begin - copyFrom(ps[true]); - wert:=abstand(ps[true],ps[false])/(ps[false].zeit-ps[true].zeit); - if (length(ws)=1) or (minB>breite) then - minB:=breite; - if (length(ws)=1) or (maxB<breite) then - maxB:=breite; - if (length(ws)=1) or (minL>laenge) then - minL:=laenge; - if (length(ws)=1) or (maxL<laenge) then - maxL:=laenge; - end; + if (ps[true].laenge < 11.47) or + (ps[true].laenge > 11.70) or + (ps[true].breite < 50.85) or + (ps[true].breite > 50.99) then + continue; + if ps[false].zeit-ps[true].zeit>=30 then + continue; + w:=abstand(ps[true],ps[false])/(ps[false].zeit-ps[true].zeit); + if w*3.6 > 100 then + continue; + setLength(ws,length(ws)+1); + ws[length(ws)-1]:=tMesswert.create; + with ws[length(ws)-1] do begin + copyFrom(ps[true]); + wert:=w; + if (length(ws)=1) or (minB>breite) then + minB:=breite; + if (length(ws)=1) or (maxB<breite) then + maxB:=breite; + if (length(ws)=1) or (minL>laenge) then + minL:=laenge; + if (length(ws)=1) or (maxL<laenge) then + maxL:=laenge; end; end; inc(i); - if i>10000 then - break; +// if i>100000 then +// break; end; for b:=false to true do ps[b].free; - writeln(minB,' .. ',maxB,' x ',minL,' .. ',maxL); + writeln(stderr,minL,' .. ',maxL,' x ',minB,' .. ',maxB); wU:=round(floor(minB*zoom)); - wHo:=round(floor(maxB*zoom)+1)-wU; + wHo:=round(floor(maxB*zoom)+1-wU); wL:=round(floor(minL*cos(minB+maxB)*zoom)); - wBr:=round(floor(maxL*cos(minB+maxB)*zoom)+1)-wL; - writeln(wBr,' x ',wHo); + wBr:=round(floor(maxL*cos(minB+maxB)*zoom)+1-wL); + writeln(stderr,wBr,' x ',wHo); setLength(anz,wBr*wHo); setLength(sum,wBr*wHo); setLength(qSum,wBr*wHo); |