diff options
author | Erich Eckner <git@eckner.net> | 2018-07-30 13:50:03 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-30 13:50:03 +0200 |
commit | dd8c2a6eeedea22559c9ac5272b37b2690ad6f4d (patch) | |
tree | f8fb4f64cd5faf68459f13e5cf6fd2ab108b70f3 | |
parent | 807f9bc2be261d6ea1ac41777f93d0895a81f444 (diff) | |
download | ROM-dd8c2a6eeedea22559c9ac5272b37b2690ad6f4d.tar.xz |
romunit.pas: dx hamonisch mitteln
-rw-r--r-- | ROM.lps | 120 | ||||
-rw-r--r-- | romunit.pas | 25 |
2 files changed, 73 insertions, 72 deletions
@@ -7,9 +7,9 @@ <Unit0> <Filename Value="ROM.lpr"/> <IsPartOfProject Value="True"/> - <TopLine Value="18"/> - <CursorPos X="28" Y="29"/> - <UsageCount Value="99"/> + <TopLine Value="246"/> + <CursorPos X="54" Y="258"/> + <UsageCount Value="103"/> <Loaded Value="True"/> </Unit0> <Unit1> @@ -17,10 +17,10 @@ <IsPartOfProject Value="True"/> <IsVisibleTab Value="True"/> <EditorIndex Value="1"/> - <TopLine Value="834"/> - <CursorPos X="14" Y="852"/> + <TopLine Value="865"/> + <CursorPos X="3" Y="888"/> <FoldState Value=" T3iE040528"/> - <UsageCount Value="99"/> + <UsageCount Value="103"/> <Loaded Value="True"/> </Unit1> <Unit2> @@ -28,13 +28,14 @@ <IsPartOfProject Value="True"/> <EditorIndex Value="-1"/> <CursorPos Y="10"/> - <UsageCount Value="98"/> + <UsageCount Value="102"/> </Unit2> <Unit3> <Filename Value="../units/matheunit.pas"/> - <EditorIndex Value="2"/> - <UsageCount Value="12"/> - <Loaded Value="True"/> + <EditorIndex Value="-1"/> + <TopLine Value="50"/> + <CursorPos X="30" Y="65"/> + <UsageCount Value="13"/> </Unit3> <Unit4> <Filename Value="../Make/tools.pas"/> @@ -43,132 +44,127 @@ </Unit4> <Unit5> <Filename Value="../units/systemunit.pas"/> - <EditorIndex Value="3"/> + <EditorIndex Value="2"/> <CursorPos Y="16"/> - <UsageCount Value="11"/> + <UsageCount Value="13"/> <Loaded Value="True"/> </Unit5> </Units> - <JumpHistory Count="30" HistoryIndex="29"> + <JumpHistory Count="29" HistoryIndex="28"> <Position1> <Filename Value="romunit.pas"/> - <Caret Line="1011" Column="58" TopLine="984"/> + <Caret Line="31" Column="14" TopLine="2"/> </Position1> <Position2> <Filename Value="ROM.lpr"/> - <Caret Line="13" Column="62"/> + <Caret Line="29" Column="60" TopLine="18"/> </Position2> <Position3> - <Filename Value="ROM.lpr"/> - <Caret Line="282" Column="20" TopLine="262"/> + <Filename Value="romunit.pas"/> + <Caret Line="294" Column="12" TopLine="277"/> </Position3> <Position4> - <Filename Value="ROM.lpr"/> - <Caret Line="279" Column="16" TopLine="266"/> + <Filename Value="romunit.pas"/> + <Caret Line="31" Column="14" TopLine="13"/> </Position4> <Position5> - <Filename Value="romunit.pas"/> - <Caret Line="30" Column="14" TopLine="23"/> + <Filename Value="ROM.lpr"/> + <Caret Line="29" Column="28" TopLine="252"/> </Position5> <Position6> - <Filename Value="ROM.lpr"/> - <Caret Line="279" Column="16" TopLine="266"/> + <Filename Value="romunit.pas"/> + <Caret Line="15" Column="30"/> </Position6> <Position7> - <Filename Value="ROM.lpr"/> - <Caret Line="17" Column="28"/> + <Filename Value="romunit.pas"/> + <Caret Line="378" Column="19" TopLine="369"/> </Position7> <Position8> - <Filename Value="ROM.lpr"/> - <Caret Line="265" Column="26" TopLine="248"/> + <Filename Value="romunit.pas"/> + <Caret Line="45" Column="20" TopLine="27"/> </Position8> <Position9> <Filename Value="romunit.pas"/> - <Caret Line="25" Column="19" TopLine="7"/> + <Caret Line="316" Column="42" TopLine="287"/> </Position9> <Position10> - <Filename Value="ROM.lpr"/> - <Caret Line="295" Column="9" TopLine="274"/> + <Filename Value="romunit.pas"/> + <Caret Line="378" Column="28" TopLine="350"/> </Position10> <Position11> <Filename Value="romunit.pas"/> - <Caret Line="32" Column="19" TopLine="14"/> + <Caret Line="964" Column="21" TopLine="953"/> </Position11> <Position12> - <Filename Value="ROM.lpr"/> - <Caret Line="295" Column="9" TopLine="268"/> + <Filename Value="romunit.pas"/> + <Caret Line="966" Column="30" TopLine="953"/> </Position12> <Position13> <Filename Value="romunit.pas"/> - <Caret Line="30" Column="14" TopLine="12"/> + <Caret Line="1045" Column="48" TopLine="988"/> </Position13> <Position14> - <Filename Value="ROM.lpr"/> - <Caret Line="335" Column="46" TopLine="302"/> + <Filename Value="romunit.pas"/> </Position14> <Position15> - <Filename Value="ROM.lpr"/> - <Caret Line="17" Column="21"/> + <Filename Value="romunit.pas"/> + <Caret Line="45" Column="20" TopLine="31"/> </Position15> <Position16> - <Filename Value="ROM.lpr"/> - <Caret Line="268" Column="64" TopLine="239"/> + <Filename Value="romunit.pas"/> + <Caret Line="316" Column="42" TopLine="329"/> </Position16> <Position17> <Filename Value="ROM.lpr"/> - <Caret Line="334" Column="51" TopLine="302"/> + <Caret Line="183" Column="98" TopLine="168"/> </Position17> <Position18> <Filename Value="ROM.lpr"/> - <Caret Line="17" Column="58"/> </Position18> <Position19> <Filename Value="ROM.lpr"/> - <Caret Line="276" Column="5" TopLine="258"/> + <Caret Line="18" Column="9"/> </Position19> <Position20> - <Filename Value="romunit.pas"/> - <Caret Line="30" Column="14" TopLine="12"/> + <Filename Value="ROM.lpr"/> + <Caret Line="26" Column="19"/> </Position20> <Position21> - <Filename Value="romunit.pas"/> - <Caret Line="737" Column="66" TopLine="708"/> + <Filename Value="ROM.lpr"/> + <Caret Line="33" Column="9" TopLine="4"/> </Position21> <Position22> <Filename Value="ROM.lpr"/> - <Caret Line="312" Column="7" TopLine="294"/> + <Caret Line="93" Column="13" TopLine="64"/> </Position22> <Position23> - <Filename Value="romunit.pas"/> - <Caret Line="13" Column="22"/> + <Filename Value="ROM.lpr"/> + <Caret Line="256" Column="21" TopLine="234"/> </Position23> <Position24> <Filename Value="romunit.pas"/> - <Caret Line="14" Column="22"/> + <Caret Line="23" Column="29" TopLine="5"/> </Position24> <Position25> - <Filename Value="romunit.pas"/> - <Caret Line="197" Column="80" TopLine="181"/> + <Filename Value="ROM.lpr"/> + <Caret Line="258" Column="14" TopLine="234"/> </Position25> <Position26> <Filename Value="romunit.pas"/> + <Caret Line="15" Column="30"/> </Position26> <Position27> - <Filename Value="romunit.pas"/> - <Caret Line="31" Column="14" TopLine="2"/> + <Filename Value="ROM.lpr"/> + <Caret Line="258" Column="14" TopLine="264"/> </Position27> <Position28> - <Filename Value="ROM.lpr"/> - <Caret Line="29" Column="60" TopLine="18"/> + <Filename Value="romunit.pas"/> + <Caret Line="32" Column="23" TopLine="14"/> </Position28> <Position29> <Filename Value="romunit.pas"/> - <Caret Line="294" Column="12" TopLine="277"/> + <Caret Line="876" Column="31"/> </Position29> - <Position30> - <Filename Value="romunit.pas"/> - <Caret Line="31" Column="14" TopLine="13"/> - </Position30> </JumpHistory> </ProjectSession> </CONFIG> diff --git a/romunit.pas b/romunit.pas index ff8ea7c..41fa0c3 100644 --- a/romunit.pas +++ b/romunit.pas @@ -869,24 +869,29 @@ begin end; procedure interpoliere(var dat: tExtPointArray); -var i,j: longint; - tmp: extended; - tdat: tExtPointArray; +var i,j: longint; + tmp,xLen: extended; + tdat: tExtPointArray; begin - tmp:=dat[1]['x']-dat[0]['x']; - for i:=2 to length(dat)-1 do - tmp:=min(tmp,dat[i]['x']-dat[i-1]['x']); - if tmp<=0 then Fehler('Die Daten müssen sortiert sein und dürfen keine doppelten x-Werte enthalten! ('+floattostr(tmp)+')'); + tmp:=0; + xLen:=dat[length(dat)-1]['x']-dat[0]['x']; + for i:=1 to length(dat)-1 do begin + if dat[i]['x']<=dat[i-1]['x'] then + Fehler('Die Daten müssen sortiert sein und dürfen keine doppelten x-Werte enthalten! ('+floattostr(tmp)+')'); + tmp:=tmp + 1/(dat[i]['x']-dat[i-1]['x']); + end; + tmp:=length(dat)/tmp; setlength(tdat,length(dat)); for i:=0 to length(dat)-1 do tdat[i]:=dat[i]; - setlength(dat,max(2*length(tdat),round(min(power(length(tdat),1.3),(tdat[length(tdat)-1]['x']-tdat[0]['x'])/tmp+1)))); + setlength(dat,round(xLen/tmp+1)); j:=0; for i:=0 to length(dat)-1 do begin - dat[i]['x']:=tdat[0]['x']+(tdat[length(tdat)-1]['x']-tdat[0]['x'])*i/(length(dat)-1); + dat[i]['x']:=tdat[0]['x'] + xLen*i/(length(dat)-1); while (j<length(tdat)-1) and (tdat[j+1]['x'] <= dat[i]['x']) do inc(j); - if j=length(tdat)-1 then tmp:=tdat[j]['y'] + if j=length(tdat)-1 then + tmp:=tdat[j]['y'] else begin tmp:=(dat[i]['x']-tdat[j]['x'])/(tdat[j+1]['x']-tdat[j]['x']); tmp:=tdat[j]['y']*(1-tmp) + tdat[j+1]['y']*tmp; |