summaryrefslogtreecommitdiff
path: root/werteunit.pas
diff options
context:
space:
mode:
Diffstat (limited to 'werteunit.pas')
-rw-r--r--werteunit.pas33
1 files changed, 24 insertions, 9 deletions
diff --git a/werteunit.pas b/werteunit.pas
index e2055eb..1b40471 100644
--- a/werteunit.pas
+++ b/werteunit.pas
@@ -1356,8 +1356,8 @@ end;
function tLLWerte.findeSchwellwerte(xMi,xMa,tMi,tMa: longint; Schw: extended): tExtPointArray;
var
- i,j,k,l,m,vz: longint;
- dX,dY,x0,y0: extended;
+ i,j,k,l,m,vz: longint;
+ dX,dY,x0,y0,anteil,w1,w2: extended;
begin
setLength(result,0);
gibAus('Schwellwerte finden ('+intToStr(xMi)+'-'+intToStr(xMa)+' x '+intToStr(tMi)+'-'+intToStr(tMa)+') '+floatToStr(Schw)+' ...',1);
@@ -1374,19 +1374,34 @@ begin
y0:=params.tStart;
for j:=xMi to xMa do begin
for k:=tMi to tMa do begin
- vz:=0;
- for l:=0 to 1 do
- for m:=0 to 1 do
- vz:=
- vz or (byte(werte[j-l+(k-m)*params.xSteps]>=Schw) shl 1) or
- byte(werte[j-l+(k-m)*params.xSteps]<=Schw);
- if vz=3 then begin
+ if werte[j+k*params.xSteps]=Schw then begin
if i>=length(result) then
setLength(result,length(result)+speicherHappen);
result[i]['x']:=j*dX+x0;
result[i]['y']:=k*dY+y0;
inc(i);
+ continue;
end;
+ if (j=0) or (k=0) then
+ continue;
+ for l:=0 to 1 do
+ for m:=0 to 1 do begin
+ w1:=werte[j-l+(k-m)*params.xSteps];
+ w2:=werte[j-m+(k-1+l)*params.xSteps];
+ if (w1=Schw) or (w2=Schw) then
+ continue;
+ if (werte[j-l+(k-m)*params.xSteps]>Schw) xor
+ (werte[j-m+(k-1+l)*params.xSteps]>Schw) then begin
+ // j-l;k-m -> werte[j-l+(k-m)*params.xSteps]
+ // j-m;k-1+l -> werte[j-m+(k-1+l)*params.xSteps]
+ anteil:= (Schw-werte[j-l+(k-m)*params.xSteps])/(werte[j-m+(k-1+l)*params.xSteps]-werte[j-l+(k-m)*params.xSteps]);
+ if i>=length(result) then
+ setLength(result,length(result)+speicherHappen);
+ result[i]['x']:=(j-l+(l-m)*anteil)*dX+x0;
+ result[i]['y']:=(k-m+(m-1+l)*anteil)*dY+y0;
+ inc(i);
+ end;
+ end;
end;
if (xMa-j) and $ff = 0 then
gibAus('x = '+intToStr(j)+' ('+intToStr(xMi)+'-'+intToStr(xMa)+')',1);