diff options
-rw-r--r-- | epost.lps | 154 | ||||
-rw-r--r-- | input_pipe.epost | 4 | ||||
-rw-r--r-- | typenunit.pas | 181 |
3 files changed, 148 insertions, 191 deletions
@@ -3,7 +3,7 @@ <ProjectSession> <Version Value="9"/> <BuildModes Active="Default"/> - <Units Count="11"> + <Units Count="6"> <Unit0> <Filename Value="epost.lpr"/> <IsPartOfProject Value="True"/> @@ -29,11 +29,12 @@ <Filename Value="epostunit.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="epostunit"/> + <IsVisibleTab Value="True"/> <EditorIndex Value="2"/> <WindowIndex Value="0"/> - <TopLine Value="2177"/> - <CursorPos X="1" Y="3664"/> - <FoldState Value=" T3od0E6 piajL04D]9XjM06611 pmYte0;8[B4k1oL0{c]Aj5lg0{#4]AXnb0{;02[M4Ipc0{6[A4NlS0~z01[C4Zr90/5]9Bl8069]9Ek30F2 pidjJ0c2[R4kE0BB]Icjc0E[I4Uk9086 pkRl60W3]INkM0B918]cbnE0G4 pnaoL0L[T46jZ052 piej80K T0j\00{1e"/> + <TopLine Value="2742"/> + <CursorPos X="1" Y="2763"/> + <FoldState Value=" T3od0E6 piajL04D]9XjM06611 pmYte0;8[B4k1oL0{c]Aj5lg0{#4]AXnb0{;02[M4Ipc0{612 p0t00{e2]?YlW033]T2jD069]9Ek30F[R4djJ0c2]IBkE0BB]Icjc0E[I4Uk9086 pkRl60W[+4NkM0B918]cbnE0G4 pnaoL0L[T46jZ052 piej80K T0j\00{1I"/> <UsageCount Value="201"/> <Loaded Value="True"/> </Unit2> @@ -64,181 +65,138 @@ <Filename Value="typenunit.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="typenunit"/> - <IsVisibleTab Value="True"/> <EditorIndex Value="4"/> <WindowIndex Value="0"/> - <TopLine Value="1948"/> - <CursorPos X="44" Y="1987"/> - <FoldState Value=" T3rK0ID pj1kA07B piajQ06G]9ZjY0N]RkemD05E]Idjb0E3]I4kQ0TA[a4k407H[95003E112317])VnV0525118]SYlY05[94fjL0H9T"/> + <TopLine Value="1"/> + <CursorPos X="3" Y="13"/> + <FoldState Value=" T3rN0ID pj1kA07B piajQ06G]9ZjY0N]RkemD05E]Idjb0E3]I4kQ0TA[a4k404H]9Yjd03[94XjT03]Rj9]+v918[T4n205[94fjL0H9u"/> <UsageCount Value="200"/> <Loaded Value="True"/> </Unit5> - <Unit6> - <Filename Value="GTIWebServerTestAggActionHandlerUnit.pas"/> - <UnitName Value="GTIWebServerTestAggActionHandlerUnit"/> - <WindowIndex Value="0"/> - <TopLine Value="34"/> - <CursorPos X="24" Y="20"/> - <UsageCount Value="0"/> - </Unit6> - <Unit7> - <Filename Value="/usr/lib/lazarus/components/aggpas/src/agg_2D.pas"/> - <UnitName Value="agg_2D"/> - <WindowIndex Value="0"/> - <TopLine Value="707"/> - <CursorPos X="9" Y="813"/> - <UsageCount Value="0"/> - <DefaultSyntaxHighlighter Value="Delphi"/> - </Unit7> - <Unit8> - <Filename Value="/usr/lib/lazarus/components/aggpas/src/agg_font_cache_manager.pas"/> - <UnitName Value="agg_font_cache_manager"/> - <WindowIndex Value="0"/> - <TopLine Value="444"/> - <CursorPos X="36" Y="463"/> - <UsageCount Value="0"/> - <DefaultSyntaxHighlighter Value="Delphi"/> - </Unit8> - <Unit9> - <Filename Value="../fpGUI/src/corelib/render/software/agg_basics.pas"/> - <UnitName Value="agg_basics"/> - <WindowIndex Value="0"/> - <TopLine Value="1"/> - <CursorPos X="1" Y="1"/> - <UsageCount Value="0"/> - </Unit9> - <Unit10> - <Filename Value="../fpGUI/src/corelib/render/software/agg_2D.pas"/> - <UnitName Value="agg_2D"/> - <WindowIndex Value="0"/> - <TopLine Value="902"/> - <CursorPos X="11" Y="913"/> - <UsageCount Value="0"/> - </Unit10> </Units> <General> <ActiveWindowIndexAtStart Value="0"/> </General> <JumpHistory Count="30" HistoryIndex="29"> <Position1> - <Filename Value="epostunit.pas"/> - <Caret Line="1131" Column="36" TopLine="1110"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1432" Column="76" TopLine="1410"/> </Position1> <Position2> - <Filename Value="epostunit.pas"/> - <Caret Line="2811" Column="63" TopLine="2789"/> + <Filename Value="typenunit.pas"/> + <Caret Line="2257" Column="1" TopLine="2067"/> </Position2> <Position3> - <Filename Value="epostunit.pas"/> - <Caret Line="3811" Column="34" TopLine="3788"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1435" Column="19" TopLine="1410"/> </Position3> <Position4> - <Filename Value="epostunit.pas"/> - <Caret Line="3823" Column="34" TopLine="3800"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1688" Column="1" TopLine="1672"/> </Position4> <Position5> - <Filename Value="epostunit.pas"/> - <Caret Line="3835" Column="36" TopLine="3812"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1724" Column="1" TopLine="1647"/> </Position5> <Position6> - <Filename Value="epostunit.pas"/> - <Caret Line="3847" Column="36" TopLine="3824"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1918" Column="1" TopLine="1773"/> </Position6> <Position7> - <Filename Value="epostunit.pas"/> - <Caret Line="3926" Column="64" TopLine="3905"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1" Column="1" TopLine="1"/> </Position7> <Position8> - <Filename Value="epostunit.pas"/> - <Caret Line="3927" Column="39" TopLine="3906"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1048" Column="24" TopLine="850"/> </Position8> <Position9> - <Filename Value="epostunit.pas"/> - <Caret Line="3943" Column="39" TopLine="3921"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1452" Column="4" TopLine="1158"/> </Position9> <Position10> - <Filename Value="epostunit.pas"/> - <Caret Line="3986" Column="11" TopLine="3964"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1461" Column="5" TopLine="1189"/> </Position10> <Position11> - <Filename Value="epostunit.pas"/> - <Caret Line="3987" Column="71" TopLine="3967"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1555" Column="30" TopLine="1491"/> </Position11> <Position12> - <Filename Value="epostunit.pas"/> - <Caret Line="4068" Column="25" TopLine="4047"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1563" Column="4" TopLine="1491"/> </Position12> <Position13> - <Filename Value="epostunit.pas"/> - <Caret Line="4076" Column="34" TopLine="4053"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1571" Column="3" TopLine="1491"/> </Position13> <Position14> <Filename Value="typenunit.pas"/> - <Caret Line="2252" Column="44" TopLine="2080"/> + <Caret Line="1581" Column="3" TopLine="1504"/> </Position14> <Position15> <Filename Value="typenunit.pas"/> - <Caret Line="277" Column="53" TopLine="289"/> + <Caret Line="1742" Column="5" TopLine="1647"/> </Position15> <Position16> - <Filename Value="epost.lpr"/> - <Caret Line="54" Column="53" TopLine="22"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1755" Column="11" TopLine="1667"/> </Position16> <Position17> <Filename Value="typenunit.pas"/> - <Caret Line="444" Column="14" TopLine="404"/> + <Caret Line="369" Column="1" TopLine="331"/> </Position17> <Position18> - <Filename Value="epostunit.pas"/> - <Caret Line="4055" Column="1" TopLine="4033"/> + <Filename Value="typenunit.pas"/> + <Caret Line="1731" Column="29" TopLine="1659"/> </Position18> <Position19> <Filename Value="typenunit.pas"/> - <Caret Line="1921" Column="2" TopLine="1933"/> + <Caret Line="227" Column="1" TopLine="226"/> </Position19> <Position20> <Filename Value="typenunit.pas"/> - <Caret Line="415" Column="38" TopLine="385"/> + <Caret Line="1730" Column="14" TopLine="1484"/> </Position20> <Position21> <Filename Value="typenunit.pas"/> - <Caret Line="1065" Column="77" TopLine="944"/> + <Caret Line="375" Column="1" TopLine="333"/> </Position21> <Position22> <Filename Value="typenunit.pas"/> - <Caret Line="1081" Column="75" TopLine="1050"/> + <Caret Line="1731" Column="36" TopLine="1707"/> </Position22> <Position23> <Filename Value="typenunit.pas"/> - <Caret Line="1110" Column="78" TopLine="1089"/> + <Caret Line="1730" Column="14" TopLine="1707"/> </Position23> <Position24> <Filename Value="typenunit.pas"/> - <Caret Line="1143" Column="88" TopLine="1110"/> + <Caret Line="207" Column="1" TopLine="207"/> </Position24> <Position25> <Filename Value="typenunit.pas"/> - <Caret Line="1241" Column="96" TopLine="1189"/> + <Caret Line="1743" Column="6" TopLine="1648"/> </Position25> <Position26> <Filename Value="typenunit.pas"/> - <Caret Line="1440" Column="84" TopLine="1328"/> + <Caret Line="1946" Column="26" TopLine="1881"/> </Position26> <Position27> - <Filename Value="typenunit.pas"/> - <Caret Line="1554" Column="58" TopLine="1455"/> + <Filename Value="epostunit.pas"/> + <Caret Line="2741" Column="13" TopLine="2737"/> </Position27> <Position28> - <Filename Value="typenunit.pas"/> - <Caret Line="1915" Column="78" TopLine="1894"/> + <Filename Value="epostunit.pas"/> + <Caret Line="1237" Column="52" TopLine="597"/> </Position28> <Position29> <Filename Value="typenunit.pas"/> - <Caret Line="1944" Column="54" TopLine="1909"/> + <Caret Line="1943" Column="1" TopLine="1883"/> </Position29> <Position30> - <Filename Value="typenunit.pas"/> - <Caret Line="1949" Column="52" TopLine="1928"/> + <Filename Value="epostunit.pas"/> + <Caret Line="2764" Column="13" TopLine="2747"/> </Position30> </JumpHistory> </ProjectSession> diff --git a/input_pipe.epost b/input_pipe.epost index acf784f..1c39d3d 100644 --- a/input_pipe.epost +++ b/input_pipe.epost @@ -127,9 +127,9 @@ lineares Bild Quotient$I # 0.5 0.2 # Nachbearbeitungsende Achse: oben 10 - Achse: links 10 + Achse: links 10+ Achse: unten 10 - Achse: rechts 10 + Achse: rechts 10+ Rahmen Ende diff --git a/typenunit.pas b/typenunit.pas index eea2724..48b0f62 100644 --- a/typenunit.pas +++ b/typenunit.pas @@ -10,6 +10,7 @@ uses const Speicherhappen = 32768; // Anzahl an mit einem Mal zu reservierender Arrayzellen myInf = 1e12; FeldgroeszenNamen: array[0..9] of string = ('FP','FM','GP','GM','EX','DENS_E','DENS_I','JX','JY','JZ'); +// verbosity: longint = 0; type tCallBackGetValue = function(name: string): extended of object; @@ -230,16 +231,18 @@ type // eine generische Transformation von Werten oder Koordinaten // selbst nicht zum Instanziieren gedacht private - procedure testeAuszerhalb(const p: tExtPoint; const xs_ts: tIntPoint); + procedure testeAuszerhalb(const p: tExtPoint); public - function transformiereAchsen(const a: t2x2Extended; const xs_ts: tIntPoint): t2x2Extended; virtual; + in_xs_ts: tIntPoint; + in_achsen: t2x2Extended; + function achsen: t2x2Extended; virtual; // wie ändern sich xstart,xstop,tstart,tstop? - function transformiereKoordinaten(const x,y: longint; const xs_ts: tIntPoint): tExtPoint; overload; - function transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; virtual; overload; + function transformiereKoordinaten(const x,y: longint): tExtPoint; overload; + function transformiereKoordinaten(const p: tExtPoint): tExtPoint; virtual; overload; // wie ändert sich die Position eines Punktes (Paradebeispiel: bei Spiegelung: x -> xsteps-1-x) function transformiereWert(const x: extended): extended; virtual; // wie ändert sich ein Wert - function xsteps_tsiz(const xs_ts: tIntPoint): tIntPoint; virtual; + function xsteps_tsiz: tIntPoint; virtual; // wie ändert sich die Ausdehnung? function dumpParams: string; virtual; end; @@ -252,14 +255,14 @@ type horizontal,vertikal: boolean; constructor create; overload; constructor create(original: tFFTTransformation); overload; - function transformiereAchsen(const a: t2x2Extended; const xs_ts: tIntPoint): t2x2Extended; override; + function achsen: t2x2Extended; override; // keine Änderung der Positionen, der Werte(skalierung), der Ausdehnung function dumpParams: string; override; end; tSpiegelungsTransformation = class (tKoordinatenTransformation) // repräsentiert die horizontale Spiegelung der Koordinaten constructor create; - function transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; override; overload; + function transformiereKoordinaten(const p: tExtPoint): tExtPoint; override; overload; // keine Änderung der Achsenbegrenzungen, der Werte(skalierung), der Ausdehnung function dumpParams: string; override; end; @@ -277,11 +280,10 @@ type expFak: tExtPoint; // Vorfaktoren der Exponentialfunktionen constructor create; overload; constructor create(original: tKonkreteKoordinatenTransformation); overload; - function transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; override; overload; + function transformiereKoordinaten(const p: tExtPoint): tExtPoint; override; overload; function initAbbildung(syntaxtest: boolean; s: string; xscale,yscale: extended; etf: tExprToFloat): boolean; - procedure berechneZielausdehnung(xsteps,tsiz: longint; out grenzen: t2x2Longint); overload; - procedure berechneZielausdehnung(const xs_ts: tIntPoint; out grenzen: t2x2Longint); overload; - function xsteps_tsiz(const xs_ts: tIntPoint): tIntPoint; override; + function zielausdehnung: t2x2Longint; + function xsteps_tsiz: tIntPoint; override; // keine Änderung der Achsenbegrenzungen, der Werte(skalierung) function dumpParams: string; override; end; @@ -289,9 +291,9 @@ type gr: t2x2Longint; constructor create; overload; constructor create(original: tKoordinatenAusschnitt); overload; - function xsteps_tsiz(const xs_ts: tIntPoint): tIntPoint; override; - function transformiereAchsen(const a: t2x2Extended; const xs_ts: tIntPoint): t2x2Extended; override; - function transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; override; overload; + function xsteps_tsiz: tIntPoint; override; + function achsen: t2x2Extended; override; + function transformiereKoordinaten(const p: tExtPoint): tExtPoint; override; overload; // keine Änderung der Werte(skalierung) function dumpParams: string; override; end; @@ -364,6 +366,7 @@ type procedure wTsiz(t: longint); function xsteps_tsiz: tIntPoint; function gibAchsen: t2x2Extended; + procedure achsenUndGroeszeAktualisieren; public property xstart: extended read rXstart @@ -1047,25 +1050,25 @@ end; // tTransformation ************************************************************* -procedure tTransformation.testeAuszerhalb(const p: tExtPoint; const xs_ts: tIntPoint); +procedure tTransformation.testeAuszerhalb(const p: tExtPoint); begin - if (p['x']<0) or (p['x']>xs_ts['x']-1) or - (p['y']<0) or (p['y']>xs_ts['y']-1) then - raise exception.create('Punkt '+tExtPointToStr(p)+' liegt außerhalb des gültigen Eingabebereich (0..'+inttostr(xs_ts['x']-1)+' x 0..'+inttostr(xs_ts['y']-1)+')!'); + if (p['x']<0) or (p['x']>in_xs_ts['x']-1) or + (p['y']<0) or (p['y']>in_xs_ts['y']-1) then + raise exception.create('Punkt '+tExtPointToStr(p)+' liegt außerhalb des gültigen Eingabebereich (0..'+inttostr(in_xs_ts['x']-1)+' x 0..'+inttostr(in_xs_ts['y']-1)+')!'); end; -function tTransformation.transformiereKoordinaten(const x,y: longint; const xs_ts: tIntPoint): tExtPoint; +function tTransformation.transformiereKoordinaten(const x,y: longint): tExtPoint; var p: tExtPoint; begin p['x']:=x; p['y']:=y; - result:=transformiereKoordinaten(p,xs_ts); + result:=transformiereKoordinaten(p); end; -function tTransformation.transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; +function tTransformation.transformiereKoordinaten(const p: tExtPoint): tExtPoint; begin result:=p; - testeAuszerhalb(p,xs_ts); + testeAuszerhalb(p); end; function tTransformation.transformiereWert(const x: extended): extended; @@ -1073,17 +1076,17 @@ begin result:=x; end; -function tTransformation.xsteps_tsiz(const xs_ts: tIntPoint): tIntPoint; +function tTransformation.xsteps_tsiz: tIntPoint; begin - result:=xs_ts; + result:=in_xs_ts; end; -function tTransformation.transformiereAchsen(const a: t2x2Extended; const xs_ts: tIntPoint): t2x2Extended; +function tTransformation.achsen: t2x2Extended; var c,d: char; begin for c:='x' to 'y' do for d:='x' to 'y' do - result[c,d]:=a[c,d]*byte((xs_ts['x']>0) and (xs_ts['y']>0)); + result[c,d]:=in_achsen[c,d]*byte((in_xs_ts['x']>0) and (in_xs_ts['y']>0)); end; function tTransformation.dumpParams: string; @@ -1107,23 +1110,23 @@ begin vertikal:=original.vertikal; end; -function tFFTTransformation.transformiereAchsen(const a: t2x2Extended; const xs_ts: tIntPoint): t2x2Extended; +function tFFTTransformation.achsen: t2x2Extended; var c: char; begin if horizontal then begin result['x','x']:=0; - result['x','y']:=(xs_ts['x']-1)/(a['x','y']-a['x','x']); + result['x','y']:=(in_xs_ts['x']-1)/(in_achsen['x','y']-in_achsen['x','x']); end else for c:='x' to 'y' do - result['x',c]:=a['x',c]; + result['x',c]:=in_achsen['x',c]; if vertikal then begin result['y','x']:=0; - result['y','y']:=(xs_ts['y']-1)/(a['y','y']-a['y','x']); + result['y','y']:=(in_xs_ts['y']-1)/(in_achsen['y','y']-in_achsen['y','x']); end else for c:='x' to 'y' do - result['y',c]:=a['y',c]; + result['y',c]:=in_achsen['y',c]; end; function tFFTTransformation.dumpParams: string; @@ -1140,10 +1143,10 @@ begin inherited create; end; -function tSpiegelungsTransformation.transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; +function tSpiegelungsTransformation.transformiereKoordinaten(const p: tExtPoint): tExtPoint; begin - testeAuszerhalb(p,xs_ts); - result['x']:=xs_ts['x']-1-p['x']; + testeAuszerhalb(p); + result['x']:=in_xs_ts['x']-1-p['x']; result['y']:=p['y']; end; @@ -1238,11 +1241,11 @@ begin result:=true; end; -function tKonkreteKoordinatenTransformation.transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; +function tKonkreteKoordinatenTransformation.transformiereKoordinaten(const p: tExtPoint): tExtPoint; var c,d: char; lt,et: extended; begin - testeAuszerhalb(p,xs_ts); + testeAuszerhalb(p); for c:='x' to 'y' do begin result[c]:=off[c]; lt:=lnOff[c]; @@ -1356,41 +1359,32 @@ begin delete(result,1,2); end; -procedure tKonkreteKoordinatenTransformation.berechneZielausdehnung(xsteps,tsiz: longint; out grenzen: t2x2Longint); -var xs_ts: tIntPoint; -begin - xs_ts['x']:=xsteps; - xs_ts['y']:=tsiz; - berechneZielausdehnung(xs_ts,grenzen); -end; - -procedure tKonkreteKoordinatenTransformation.berechneZielausdehnung(const xs_ts: tIntPoint; out grenzen: t2x2Longint); +function tKonkreteKoordinatenTransformation.zielausdehnung: t2x2Longint; var RandPkt: tExtPoint; i,j,k: longint; c,d: char; begin for c:='x' to 'y' do for d:='x' to 'y' do - grenzen[c,d]:=-1; + result[c,d]:=-1; for k:=0 to 1 do - for i:=0 to (xs_ts['x']*(1-k)+xs_ts['y']*k)-1 do + for i:=0 to (in_xs_ts['x']*(1-k)+in_xs_ts['y']*k)-1 do for j:=0 to 1 do begin RandPkt:=transformiereKoordinaten( - i*(1-k) + j*k*(xs_ts['x']-1), - j*(1-k)*(xs_ts['y']-1) + i*k, - xs_ts); + i*(1-k) + j*k*(in_xs_ts['x']-1), + j*(1-k)*(in_xs_ts['y']-1) + i*k); for c:='x' to 'y' do for d:='x' to 'y' do - if ((i=0) and (j=0)) or ((d='y') xor (grenzen[c,d]>floor(RandPkt[c]) + byte(d='y'))) then - grenzen[c,d]:=floor(RandPkt[c]) + byte(d='y'); + if ((i=0) and (j=0)) or ((d='y') xor (result[c,d]>floor(RandPkt[c]) + byte(d='y'))) then + result[c,d]:=floor(RandPkt[c]) + byte(d='y'); end; end; -function tKonkreteKoordinatenTransformation.xsteps_tsiz(const xs_ts: tIntPoint): tIntPoint; +function tKonkreteKoordinatenTransformation.xsteps_tsiz: tIntPoint; var gr: t2x2Longint; c: char; begin - berechneZielausdehnung(xs_ts['x'],xs_ts['y'],gr); + gr:=zielausdehnung; for c:='x' to 'y' do result[c]:=gr[c,'y']-gr[c,'x']+1; end; @@ -1415,32 +1409,32 @@ begin gr[c,d]:=original.gr[c,d]; end; -function tKoordinatenAusschnitt.xsteps_tsiz(const xs_ts: tIntPoint): tIntPoint; +function tKoordinatenAusschnitt.xsteps_tsiz: tIntPoint; var c: char; begin for c:='x' to 'y' do - result[c]:=max(0,min(xs_ts[c],gr[c,'y']+1)-gr[c,'x']); + result[c]:=max(0,min(in_xs_ts[c],gr[c,'y']+1)-gr[c,'x']); end; -function tKoordinatenAusschnitt.transformiereAchsen(const a: t2x2Extended; const xs_ts: tIntPoint): t2x2Extended; +function tKoordinatenAusschnitt.achsen: t2x2Extended; var c,d: char; begin for c:='x' to 'y' do - if xs_ts[c]<=1 then begin + if in_xs_ts[c]<=1 then begin for d:='x' to 'y' do - result[c,d]:=a[c,d]; - if a[c,'x']<>a[c,'y'] then - fehler('Nur eine Koordinate, aber '+floattostr(a[c,'x'])+' = '+c+'start <> '+c+'stop = '+floattostr(a[c,'y'])+'!'); + result[c,d]:=in_achsen[c,d]; + if in_achsen[c,'x']<>in_achsen[c,'y'] then + fehler('Nur eine Koordinate, aber '+floattostr(in_achsen[c,'x'])+' = '+c+'start <> '+c+'stop = '+floattostr(in_achsen[c,'y'])+'!'); end else for d:='x' to 'y' do - result[c,d]:=a[c,'x'] + gr[c,d]/(xs_ts[c]-1)*(a[c,'y']-a[c,'x']); + result[c,d]:=in_achsen[c,'x'] + gr[c,d]/(in_xs_ts[c]-1)*(in_achsen[c,'y']-in_achsen[c,'x']); end; -function tKoordinatenAusschnitt.transformiereKoordinaten(const p: tExtPoint; const xs_ts: tIntPoint): tExtPoint; +function tKoordinatenAusschnitt.transformiereKoordinaten(const p: tExtPoint): tExtPoint; var c: char; begin - testeAuszerhalb(p,xs_ts); + testeAuszerhalb(p); for c:='x' to 'y' do result[c]:=max(0,min(gr[c,'y'],p[c])-gr[c,'x']); end; @@ -1693,12 +1687,9 @@ begin end; function tTransformationen.xsteps_tsiz: tIntPoint; -var i: longint; begin - result:=_xs_ts; - for i:=0 to count-1 do - if inhalt[i] is tKoordinatenTransformation then - result:=(inhalt[i] as tKoordinatenTransformation).xsteps_tsiz(result); + if count=0 then result:=_xs_ts + else result:=last.xsteps_tsiz; end; procedure tTransformationen.wTsiz(t: longint); @@ -1733,18 +1724,27 @@ begin inc(result); end; -function tTransformationen.gibAchsen: t2x2Extended; -var i: longint; - xs_ts: tIntPoint; +procedure tTransformationen.achsenUndGroeszeAktualisieren; +var i: longint; begin - result:=_xtstao; - xs_ts:=_xs_ts; for i:=0 to count-1 do begin - result:=inhalt[i].transformiereAchsen(result,xs_ts); - xs_ts:=inhalt[i].xsteps_tsiz(xs_ts); + if i=0 then begin + schritte[i].in_xs_ts:=_xs_ts; + schritte[i].in_achsen:=_xtstao; + end + else begin + schritte[i].in_xs_ts:=schritte[i-1].xsteps_tsiz; + schritte[i].in_achsen:=schritte[i-1].achsen; + end end; end; +function tTransformationen.gibAchsen: t2x2Extended; +begin + if count=0 then result:=_xtstao + else result:=last.achsen; +end; + function tTransformationen.last: tTransformation; begin result:=gibInhalt(count-1); @@ -1772,6 +1772,7 @@ begin inc(j); end; setlength(Schritte,j); + achsenUndGroeszeAktualisieren; end; procedure tTransformationen.addFFT(hor,ver: boolean); @@ -1782,12 +1783,14 @@ begin horizontal:=hor; vertikal:=ver; end; + achsenUndGroeszeAktualisieren; end; procedure tTransformationen.AddSpiegelung; begin setlength(Schritte,length(Schritte)+1); Schritte[length(Schritte)-1]:=tSpiegelungsTransformation.create; + achsenUndGroeszeAktualisieren; end; function tTransformationen.add(inh: tTransformation): boolean; @@ -1814,6 +1817,7 @@ begin gibAus('Ich kann unbekannten Transformationstyp ('+inh.ClassName+') nicht einfügen, da ich ihn nicht kopieren kann!',3); exit; end; + achsenUndGroeszeAktualisieren; result:=true; end; @@ -1881,6 +1885,7 @@ begin setlength(Schritte,length(Schritte)+1); Schritte[length(Schritte)-1]:=tKonkreteKoordinatenTransformation.create; result:=(last as tKonkreteKoordinatenTransformation).initAbbildung(syntaxtest,s,xscale,yscale,etf); + achsenUndGroeszeAktualisieren; end; function tTransformationen.append(inhs: tTransformationen): boolean; @@ -1889,6 +1894,7 @@ begin result:=true; for i:=0 to inhs.count-1 do result:=result and add(inhs[i]); + achsenUndGroeszeAktualisieren; end; procedure tTransformationen.addAusschnitt(xmin,xmax,tmin,tmax: longint); @@ -1899,28 +1905,28 @@ begin (last as tKoordinatenAusschnitt).gr['x','y']:=xmax; (last as tKoordinatenAusschnitt).gr['y','x']:=tmin; (last as tKoordinatenAusschnitt).gr['y','y']:=tmax; -// last.off['x']:=-xmin*last.lin['x','x']; // man muss sich nur die Verschiebung merken, -// last.off['y']:=-tmin*last.lin['y','y']; // das Abschneiden kommt einfach durch die kleineren tsiz und xsteps zustande + achsenUndGroeszeAktualisieren; end; function tTransformationen.kopiereVon(original: tTransformationen): boolean; begin clear; - result:=append(original); _xs_ts:=original._xs_ts; _xtstao:=original._xtstao; _wmia:=original._wmia; + result:=append(original); end; function tTransformationen.transformiereKoordinaten(const lage: tLage; const x: extended): extended; var p: tExtPoint; c,d: char; begin - c:=char(ord('x')+byte(lage in [lOben,lUnten])); - d:=char(ord('x')+byte(not(lage in [lOben,lUnten]))); + c:=char(ord('x')+byte(not(lage in [lOben,lUnten]))); + d:=char(ord('x')+byte(lage in [lOben,lUnten])); if lage in [lLinks,lUnten] then p[d]:=0 else p[d]:=1; - p[c]:=(x-_xtstao[c,'x'])/(_xtstao[c,'y']-_xtstao[c,'x']); + + p[c]:=(x-gibAchsen[c,'x'])/(gibAchsen[c,'y']-gibAchsen[c,'x']); for d:='x' to 'y' do p[d]:=p[d]*(_xs_ts[d]-1); p:=transformiereKoordinaten(p); @@ -1936,14 +1942,10 @@ end; function tTransformationen.transformiereKoordinaten(const p: tExtPoint): tExtPoint; var i: longint; - xs_ts: tIntPoint; begin result:=p; - xs_ts:=_xs_ts; - for i:=0 to count-1 do begin - result:=inhalt[i].transformiereKoordinaten(result,xs_ts); - xs_ts:=inhalt[i].xsteps_tsiz(xs_ts); - end; + for i:=0 to count-1 do + result:=inhalt[i].transformiereKoordinaten(result); end; function tTransformationen.transformiereWert(const x: extended): extended; @@ -1966,12 +1968,10 @@ procedure tTransformationen.berechneZielausdehnung(out grenzen: t2x2Longint); var RandPkt: tExtPoint; i,j,k: longint; c,d: char; - zeit: extended; begin for c:='x' to 'y' do for d:='x' to 'y' do grenzen[c,d]:=-1; - zeit:=now; for k:=0 to 1 do for i:=0 to (_xs_ts['x']*(1-k)+_xs_ts['y']*k)-1 do for j:=0 to 1 do begin @@ -1984,7 +1984,6 @@ begin ((k=0) and (i=0) and (j=0)) then grenzen[c,d]:=floor(RandPkt[c]) + byte(d='y'); end; - gibAus(Zeitdarstellen(now-Zeit),3); halt; end; // allgemeine Funktionen ******************************************************* |