summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-07-30 16:04:48 +0200
committerErich Eckner <git@eckner.net>2018-07-30 16:04:48 +0200
commit674fa0edf8db245d0bb78f95b87b06dbd72ef645 (patch)
tree8557e575565c39da93f0fe326267b7b358674e30
parent59cecd0385f90e25ce6c73782d5b01bba5bc5f7c (diff)
downloadROM-674fa0edf8db245d0bb78f95b87b06dbd72ef645.tar.xz
romunit.pas: Fenstermitte zum Fenstern wird nun nicht am Maximum, sonder am Halbwert des Peak-to-Peak festgelegt
-rw-r--r--romunit.pas33
1 files changed, 23 insertions, 10 deletions
diff --git a/romunit.pas b/romunit.pas
index 28e0df5..bfd4ca9 100644
--- a/romunit.pas
+++ b/romunit.pas
@@ -1063,7 +1063,8 @@ procedure fenstern(var dat: tExtPointArray; breite: extended; alteMitte: boolean
var
i,j,len: longint;
extrema: tLongintArray;
- pp,mpp: extended;
+ pps: tExtendedArray;
+ mpp: extended;
begin
if not alteMitte then begin
setlength(extrema,0);
@@ -1077,19 +1078,31 @@ begin
inc(len);
end;
setlength(extrema,len);
- fensterMitte:=-1;
- mpp:=-1;
+ setlength(pps,len);
for i:=0 to length(extrema)-1 do begin
- pp:=-1;
+ pps[i]:=-1;
for j:=0 to length(extrema)-1 do
if (abs(dat[extrema[j]]['x']-dat[extrema[i]]['x'])<2) and
- (abs(dat[extrema[j]]['y']-dat[extrema[i]]['y'])>pp) then
- pp:=abs(dat[extrema[j]]['y']-dat[extrema[i]]['y']);
- if pp>mpp then begin
- mpp:=pp;
- fensterMitte:=extrema[i];
- end;
+ (abs(dat[extrema[j]]['y']-dat[extrema[i]]['y'])>pps[i]) then
+ pps[i]:=abs(dat[extrema[j]]['y']-dat[extrema[i]]['y']);
end;
+ mpp:=pps[0];
+ for i:=0 to length(pps)-1 do
+ if pps[i]>mpp then
+ mpp:=pps[i];
+ i:=0;
+ while (i<length(pps)) and
+ (pps[i]<mpp/2) do
+ inc(i);
+ j:=length(pps)-1;
+ while (j>=0) and
+ (pps[j]<mpp/2) do
+ dec(j);
+ mpp:=(dat[extrema[i]]['x']+dat[extrema[j]]['x'])/2;
+ fensterMitte:=0;
+ while (fensterMitte<length(dat)) and
+ (dat[fensterMitte]['x']<mpp) do
+ inc(fensterMitte);
end;
for i:=0 to length(dat)-1 do