home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
text
/
pastex-1.3-7of9.lha
/
PasTeX
/
MF
/
inputs
/
PassauLogos
/
unilogos.mf
< prev
next >
Wrap
Text File
|
1994-06-09
|
11KB
|
365 lines
def SetZ( expr n, v ) =
x[n] := xpart(v);
y[n] := ypart(v);
enddef;
def OverwriteSystem = true enddef;
def NoOverwriteSystem = false enddef;
numeric STD_INPUTSCALEX; % Standard Eingabeskalierung in X-Richtung
numeric STD_INPUTSCALEY; % Standard Eingabeskalierung in Y-Richtung
numeric STD_OUTPUTSCALEX; % Standard Ausgabeskalierung in X-Richtung
numeric STD_OUTPUTSCALEY; % Standard Ausgabeskalierung in Y-Richtung
STD_INPUTSCALEX = 1;
STD_INPUTSCALEY = 1;
STD_OUTPUTSCALEX = 1;
STD_OUTPUTSCALEY = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%% Datenstruktur der Koordinatensysteme als Stapel:
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Der SystemStack wird in den Bereich der z-Variablen gelegt.
%%% Ein System besteht aus den folgenden Komponenten:
% - (2) pair Nullpunkt
% - (2) pair Basisvektor1
% - (1) numeric Eingabe-Streckungsfaktor Basisvektor1
% - (1) numeric Ausgabe-Streckungsfaktor Basisvektor1
% - (2) pair Basisvektor2
% - (1) numeric Eingabe-Streckungsfaktor Basisvektor2
% - (1) numeric Ausgabe-Streckungsfaktor Basisvektor2
% - (1) numeric Drehwinkel Basisvektor2
% - (1) numeric Drehwinkel Basisvektor2
% (6) Speicherplaetze in der Summe als Pair.
%%% Variablen:
numeric MAXSYSTEMS; % Maximale Zahl verschachtelter Systeme
numeric SYS_PAIRS; % Anzahl Speicherplaetze eines Systems
numeric SYS_STACKMIN; % Untere Grenze des SystemStacks
numeric SYS_STACKMAX; % Obere Grenze des SystemStacks
numeric SYS_TOP; % Zeiger auf oberstes SystemStackElement
numeric SysRecDepth_Max;
numeric SysRecDepth_UserMaximal;
numeric SysRecDepth_UserActual;
MAXSYSTEMS = 10; % Maximal 10 Systeme verschachtelt.
SYS_PAIRS = 6;
SYS_STACKMIN = 0; % SYS_STACK kommt zuerst im Speicher.
% Platz fuer das Root-System muss reserviert werden:
SYS_STACKMAX = SYS_STACKMIN + ((MAXSYSTEMS+1) * SYS_PAIRS - 1);
% SystemInformationen:
SysRecDepth_Max = MAXSYSTEMS;
SysRecDepth_UserMaximal = 0;
SysRecDepth_UserActual = 0;
%%% Zugriffsoperationen:
def Origin = z[SYS_TOP+0] enddef;
def BaseX = z[SYS_TOP+1] enddef;
def BaseY = z[SYS_TOP+2] enddef;
def InputScaleX = xpart(z[SYS_TOP+3]) enddef;
def InputScaleY = ypart(z[SYS_TOP+3]) enddef;
def OutputScaleX = xpart(z[SYS_TOP+4]) enddef;
def OutputScaleY = ypart(z[SYS_TOP+4]) enddef;
def RotationX = xpart(z[SYS_TOP+5]) enddef;
def RotationY = ypart(z[SYS_TOP+5]) enddef;
def SystemDepth = (SYS_TOP/SYS_PAIRS) enddef;
def FatherOrigin = z[SYS_TOP-SYS_PAIRS+0] enddef;
def FatherBaseX = z[SYS_TOP-SYS_PAIRS+1] enddef;
def FatherBaseY = z[SYS_TOP-SYS_PAIRS+2] enddef;
def FatherInputScaleX = xpart(z[SYS_TOP-SYS_PAIRS+3]) enddef;
def FatherInputScaleY = ypart(z[SYS_TOP-SYS_PAIRS+3]) enddef;
def FatherOutputScaleX = xpart(z[SYS_TOP-SYS_PAIRS+4]) enddef;
def FatherOutputScaleY = ypart(z[SYS_TOP-SYS_PAIRS+4]) enddef;
def FatherRotationX = xpart(z[SYS_TOP-SYS_PAIRS+5]) enddef;
def FatherRotationY = ypart(z[SYS_TOP-SYS_PAIRS+5]) enddef;
def InitSystemStack =
% Setzen des Root-Systemes, das nicht veraendert werden kann:
SetZ( SYS_STACKMIN+0, (0,0) );
SetZ( SYS_STACKMIN+1, (1,0) );
SetZ( SYS_STACKMIN+2, (0,1) );
SetZ( SYS_STACKMIN+3, (STD_INPUTSCALEX, STD_INPUTSCALEY ) );
SetZ( SYS_STACKMIN+4, (STD_OUTPUTSCALEX,STD_OUTPUTSCALEY) );
SetZ( SYS_STACKMIN+5, (0,0) );
% Zeiger auf das oberste Stackelement wird auf das
% zweite Stackelement gesetzt, da das erste das
% Root-System ist und nicht geaendert werden darf:
SYS_TOP := SYS_STACKMIN + SYS_PAIRS;
% Setzen des ersten Systemes auf Standard-Werte:
SetZ( SYS_STACKMIN+SYS_PAIRS+0, (0,0) );
SetZ( SYS_STACKMIN+SYS_PAIRS+1, (1,0) );
SetZ( SYS_STACKMIN+SYS_PAIRS+2, (0,1) );
SetZ( SYS_STACKMIN+SYS_PAIRS+3, ( CharWidth, CharHeight ) );
SetZ( SYS_STACKMIN+SYS_PAIRS+4, ( CharWidth, CharHeight ) );
SetZ( SYS_STACKMIN+SYS_PAIRS+5, (0,0) );
% Anzeigen Stack-Groesse:
% showvariable MAXSYSTEMS;
enddef;
def CreateSystem( expr Null,
PInputScaleX, POutputScaleX, RotX,
PInputScaleY, POutputScaleY, RotY,
Overwrite
) =
% Aktuelles System soll nicht ueberschrieben werden? ->
% Erst ein neues Stapelelement erzeugen.
if not Overwrite:
SYS_TOP := SYS_TOP + SYS_PAIRS;
if ((SYS_TOP-SYS_STACKMIN)/SYS_PAIRS)-1
> SysRecDepth_UserMaximal:
SysRecDepth_UserMaximal := SYS_TOP-SYS_PAIRS
fi
fi;
% Nullpunkt bzgl. Vatersystem berechnen und eintragen:
SetZ( SYS_TOP+0, FatherOrigin +
( xpart(Null)/FatherInputScaleX*FatherOutputScaleX
*
FatherBaseX
)
+
( ypart(Null)/FatherInputScaleY*FatherOutputScaleY
*
FatherBaseY
) );
% Basisvektor1: die Drehung wird zur Drehung des
% Vater-Basisvektors1 addiert.
SetZ( SYS_TOP+1, FatherBaseX rotated RotX );
% Basisvektor2: die Drehung wird zur Drehung des
% Vater-Basisvektors2 addiert.
SetZ( SYS_TOP+2, FatherBaseY rotated RotY );
SetZ( SYS_TOP+3, ( PInputScaleX, PInputScaleY ) );
SetZ( SYS_TOP+4,
( (POutputScaleX/FatherInputScaleX)*CharWidth,
(POutputScaleY/FatherInputScaleY)*CharHeight
) );
% Rotationswinkel werden einfach addiert
% und nur der Genauigkeit wegen mit abgespeichert.
SetZ( SYS_TOP+5, ( RotX + FatherRotationX,
RotY + FatherRotationY ) );
enddef;
def PrintSystem =
pair origin;
pair x_base;
pair y_base;
numeric x_inputscale;
numeric y_inputscale;
numeric x_outputscale;
numeric y_outputscale;
numeric x_rotation;
numeric y_rotation;
numeric system_nesting_deepness;
system_nesting_deepness = SystemDepth;
origin = Origin;
x_base = BaseX;
y_base = BaseY;
x_inputscale := InputScaleX;
y_inputscale := InputScaleY;
x_outputscale := OutputScaleX;
y_outputscale := OutputScaleY;
x_rotation := RotationX;
y_rotation := RotationY;
show " ##### datas of the actual system:";
showvariable system_nesting_deepness;
showvariable origin;
showvariable x_base;
showvariable x_inputscale;
showvariable x_outputscale;
showvariable x_rotation;
showvariable y_base;
showvariable y_inputscale;
showvariable y_outputscale;
showvariable y_rotation;
enddef;
def ChangeSystem( expr Null,
InputScaleX, OutputScaleX, RotX,
InputScaleY, OutputScaleY, RotY
) =
CreateSystem( Null,
InputScaleX, OutputScaleX, RotX,
InputScaleY, OutputScaleY, RotY,
OverwriteSystem
)
enddef;
def EnterSystem( expr Null,
InputScaleX, OutputScaleX, RotX,
InputScaleY, OutputScaleY, RotY
) =
if SYS_TOP + SYS_PAIRS < SYS_STACKMAX:
CreateSystem( Null,
InputScaleX, OutputScaleX, RotX,
InputScaleY, OutputScaleY, RotY,
NoOverwriteSystem
)
% else:
% show " ";
% show " System-Stack-Overflow: (EnterSystem) ";
% show " Your systems are too deeply nested!";
% show " If you really want to nest your systems deeper, ";
% show " then you should enlarge the SystemStack: ";
% showvariable MAXSYSTEMS;
% errmessage "Sorry";
fi;
enddef;
def LeaveSystem =
if SYS_TOP > (SYS_STACKMIN + SYS_PAIRS):
SYS_TOP := SYS_TOP - SYS_PAIRS;
else:
show " ";
show " System-Stack-Underflow: (LeaveSystem) ";
show " There is no more System to leave! ";
errmessage "Sorry";
fi;
enddef;
def CopySystem =
EnterSystem( (0,0), InputScaleX, InputScaleX, 0,
InputScaleY, InputSc