Anhang 2: Mathematische Formeln für Teilbilder
Transformationen
In this appendix positions in a logical coordinate system will be
represented by a row vector with two elements, as in /_ x y_/. Vectors
and matrices will be delimited by these funny brackets: /_ _/. Various
symbols will be used to represent parameters in a full subpicture call
relating to a transformation from one coordinate system to another;
these are defined below:
Mx and My : magnifications in x and y to be applied before any
rotation.
They may be negative indicating reflection.
A: an angle of rotation in the range 0 to just less than 2pi.
/_ |cx |cy_/ : the center (in the calling picture) of the image of the
subpicture.
|sx |sy : the half-sizes, in the x and y directions, of the
image on the calling page in terms of the calling page's
coordinate system.
They may be negative to indicate reflection.
/_ x y_/ : a position on the called page.
/_ |x |y_/ : the position on the calling page corresponding to /_x y_/.
/_ Pcx Pcy_/ : The center of the portion of the called subpicture's
coordinate system which is to be mapped to the calling
page.
This defaults to /_ 0 0_/ if not specified.
Psx and Psy : The half-sizes in x and y of the portion of the
subpicture to be mapped. These both default to +1/2
in not specified.
(If a uniform magnification is specified, set Mx and My equal to it and
proceed below as if they were specified.)
If magnifications are specified, the following holds:
/_ |x |y_/ = (/_ x y_/ - /_ Pcx Pcy_>) * / Mx/Psx 0 / *
/_ 0 My/Psy_/
/ cos 0 sin 0 / * / 1/2 0 / + /_ |cx |cy_/
/_ -sin0 cos0_/ /_ 0 1/2_/
or in other words,
1)
/_|x |y_/ = /_ x-Pcx y-Pcy_/ * / Mx cosA/2Psx Mx sinA/2Psx /
/_ -My sinA/2Psy My cosA/2Psy_/
+/_ |cx |cy_/
(The factor of 1/2 is necessary because, for instance, (x-Pcx)/Psx
ranges from -1 to +1 for x values within the portion (i.e., such that
|x-Pcx| <|Psx| ) whereas the image, in the calling subpicture's
coordinate system, should only range from -1/2 to +1/2.)
If the image size is specified instead of the magnification, we have the
following:
/_ |x |y_/ = (/_ x y_/ - /_Pcx Pcy_/) * / 1/Psx 0 / *
/_ 0 1/Psy _/
/ cosA sinA / * / |sx 0 / + /_ |cx |cy_/
/_ -sinA cosA _/ /_ 0 |sy _/
or, in other words,
2)
/_|x |y_/ = /_x-Pcx y-Pcy_/ * /|sx cosA/Psx |sy sinA/Psx /
/_-|sx sinA/Psy |sy cosA/Psy_/
+ /_|cx |cy_/
Expanding the parenthesized quantities in equations 1) and 2), we
have:
3a) /_|x |y_/ = /_x y_/ * /Mx cosA/2Psx Mx sinA/2Psx /
/_-My sinA/2Psy My cosA/2Psy_/
+ /_|cx-PcxMxcosA/2Psx+PcyMysinA/2Psy
|cy-PcxMxsinA/2Psx-PcyMycosA/2Psy _/
and
3b) /_|x |y_/ = /_x y_/ * /|sx cosA/Psx |sy sinA/Psx /
/_-|sx sinA/Psy |sy cosA/Psy_/
+ /_|cx-Pcx|sxcosA/Psx+Pcy|sxsinA/Psy
|cy-Pcy|sysinA/Psx-Pcy|sycosA/Psy_/
Various interesting substitutions can be made in 3a) and 3b).
For example, if A=0 (no rotation), then we have:
4a) /_|x |y_/ = /_x y_/ * /Mx/2Psx 0 / + /_|cx-PcxMx/2Psx
|cy-PcyMy/2Psy_/
/_ 0 My/2Psy_/
4b) /_|x |y_/ = /_x y_/ * /|sx/Psx 0 / + /_|cx-Pcx|sx/Psx
|cy-Pcy|sy/Psy_/
/_ 0 |sy/Psy_/
Another example is if no portioning is done (Pcx=Pcy=0, Psx=Psy=1/2):
5a) /_|x |y_/ = /_ x y_/ * /Mx cosA Mx sinA / + /_|cx |cy_/
/_-My sinA My sinA_/
5b) /_|x |y_/ = /_ x y_/ * /2|sx cosA 2|sy sinA / + /_|cx |cy_/
/_-2|sx sinA 2|sx cosA_/
If in addition, 0=0, we have:
6a) /_|x |y_/ = /_ xMx+|cx yMy+|cy_/
6b) /_|x |y_/ = /_ x*2|sx+|cx y*2|sy+|cy_/
Of course, in all cases, the transformation from /_x y_/ to /_|x |y_/
can be written in the form:
/_|x |y_/ = /_x y_/ * / 2 by 2 / + /_ translation _/
/_ matrix _/
In general, a transformation combining a linear transformation and a
translation is called an affine transformation.
Der obige Block gibt die textuell gesetzten Formeln des Originals unverändert wieder. Bedeutung der Symbole: Mx und My sind die vor jeder Drehung anzuwendenden Vergrößerungen in x und y (sie können negativ sein, was eine Spiegelung bedeutet); A ist der Drehwinkel; (cx, cy) ist der Mittelpunkt des Abbilds des Teilbildes im aufrufenden Bild; sx und sy sind die Halbgrößen des Abbilds auf der aufrufenden Seite in x- und y-Richtung; (Pcx, Pcy) ist der Mittelpunkt des abzubildenden Ausschnitts im Koordinatensystem des aufgerufenen Teilbildes (Standard (0, 0)); Psx und Psy sind die Halbgrößen dieses Ausschnitts in x und y (Standard jeweils +1/2).
Transformationen bei verschachtelten Ebenen
The combination of two affine transformations is again an affine
transformation. Indeed, if
/_|x |y_/ = /_x y_/ * / Mat1 / + /_ Tran1 _/
/_ _/
and
/_|x_ |y__/ = /_|x |y_/ * ( / Mat1 / * / Mat2 /)
/_ _/ /_ _/
+ (/_ Tran2 _/ + /_ Tran1 _/ * / Mat2 /)
/_ _/
Bei verschachtelten Aufrufen vollständiger Teilbilder müssen die Daten auf jeder Ebene daher nur einmal transformiert werden, nämlich durch die Transformation, die sich aus den Einzelschritt-Transformationen jeder Verschachtelungsebene zusammensetzt. Eine neue affine „Gesamtkombinations“-Transformation sollte jedes Mal berechnet werden, wenn ein vollständiges Teilbild aufgerufen wird (nach dem Ablegen der aktuellen Transformation auf dem Keller), indem die aktuelle Gesamtkombination mit der affinen Transformation für diesen besonderen Teilbildaufruf kombiniert wird.
Ausschnitte bei verschachtelten Ebenen
Solange keine Drehungen beteiligt sind, oder auch nur Drehungen um Vielfache von pi/2, lassen sich mehrere Ebenen von Ausschnitten leicht implementieren. In der Diskussion der nächsten beiden Absätze nehmen wir an, dass außer ganzzahligen Vielfachen von pi/2 keine Drehungen beteiligt sind.
So wie man eine „Gesamtkombinations“-Transformation (affin) mitführen kann, kann man auch eine Gesamtkombination von Ausschnitten mitführen. Auf jeder Ebene kann man wie folgt vorgehen: Eine Kopie des aktuellen Gesamtausschnitts sichern und die Umkehrung der Einzelebenen-Affintransformation (im Teilbildaufruf angegeben) verwenden, um zu bestimmen, welches Rechteck der aufgerufenen Seite dem aktuellen Gesamtausschnitt (auf der aufrufenden Seite) entspricht.
Zwischen diesem Rechteck und dem im Teilbildaufruf angegebenen (oder per Standard vorgegebenen) Rechteck können verschiedene Beziehungen bestehen. Sie können disjunkt sein (dann muss dieses Teilbild gar nicht aufgerufen werden); sie können gleich sein (ein einfacher Fall); eines kann das andere enthalten, oder sie können sich teilweise überlappen. Gibt es eine Schnittmenge, ist sie ein Rechteck, und dieses Rechteck wird der neue Gesamtkombinationsausschnitt.
Das Problem bei Drehungen, die keine Vielfachen von pi/2 sind, besteht darin, dass das Urbild des Rechtecks nicht mehr in der Standardausrichtung (vertikale und horizontale Kanten) liegt. Das bedeutet, dass seine Schnittmenge mit dem im Teilbildaufruf angegebenen Ausschnitt (falls nicht leer) 3, 4, 5, 6, 7 oder 8 Kanten haben kann. Tiefere Ebenen können noch schlimmer werden, wenn sie ebenfalls Drehungen beinhalten. Zwar mag es (für manche) keine begriffliche Schwierigkeit bereiten, mit einer solchen Situation zu arbeiten, doch ist deutlich mehr Rechenaufwand erforderlich als im einfachen Fall horizontaler und vertikaler Kanten.
Dieses Protokoll gibt keine Empfehlung für den Fall ab, dass Drehungen, die keine ganzzahligen Vielfachen von pi/2 sind, mit Ausschnitten zusammentreffen. Es schlägt vor, verschachtelte Ausschnitte im oben beschriebenen unkomplizierteren Fall wie dort beschrieben zu behandeln.
[This RFC was put into machine readable form for entry]
[into the online RFC archives by Helene Morin, Via Genie, 12/1999]