summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xypic/xyrotate.tex
blob: 0b9bb2f8b27213310a66c36c4f229fcb58b7ad60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
%% xyrotate.tex from $Id: xyrotate.doc,v 3.3 1996/12/18 09:40:16 ross Exp $
%%
%% Xy-pic ``Rotate and Scale extension'' option.
%% Copyright (c) 1993-1996 Ross Moore <ross@mpce.mq.edu.au>
%%
%% This file is part of the Xy-pic package for graphs and diagrams in TeX.
%% See the companion README and INSTALL files for further information.
%% Copyright (c) 1991-1996 Kristoffer H. Rose <krisrose@brics.dk>
%%
%% The Xy-pic package is free software; you can redistribute it and/or modify
%% it under the terms of the GNU General Public License as published by the
%% Free Software Foundation; either version 2 of the License, or (at your
%% option) any later version.
%%
%% The Xy-pic package is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
%% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
%% for more details.
%%
%% You should have received a copy of the GNU General Public License along
%% with this package; if not, write to the Free Software Foundation, Inc.,
%% 675 Mass Ave, Cambridge, MA 02139, USA.
%%
\ifx\xyloaded\undefined \input xy \fi
\xyprovide{rotate}{Rotate and Scale extension}{\stripRCS$Revision: 3.3 $}%
 {Ross Moore}{ross@mpce.mq.edu.au}%
 {Mathematics Department, Macquarie University, NSW~2109, Australia}
\xydef@\xyundefinedRotate@#1#2@@{%
 \xywarning@{The #1 #2 effect is not implemented with the current driver.}}%
\xydef@\NoResizing{\xyNoResizing@}
\xydef@\UseResizing{\xyUseResizing@}
\xydef@\xyNoResizing@{%
 \global\let\origxyrescale@=\xyrescale@
 \global\let\origxyrotSizeMod@=\xyrotateSizeMod@
 \global\let\xyNoResizing@=\xyNoResizing@@
 \global\let\xyUseResizing@=\xyUseResizing@@
 \xyNoResizing@@ }
\xydef@\xyNoResizing@@{%
 \global\let\xyrescale@=\xyignorescale@
 \global\let\xyrotateSizeMod@=\xyignoreSizeMod@
 }
\xylet@\xyUseResizing@=\relax
\xydef@\xyUseResizing@@{%
 \global\let\xyrescale@=\origxyrescale@
 \global\let\xyrotateSizeMod@=\origxyrotSizeMod@
 }
\xydefcsname@{shape [@...]}#1{\xyrotatechar@#1@@}%
\xydefcsname@{shape [<...]}#1{\xyshearchar@{#1}@@}%
\xydefcsname@{shape [*...]}#1{\xyscalechar@{#1}@@}%
\xydefcsname@{shape [left]}{\xyshape@left@}
\xydefcsname@{shape [right]}{\xyshape@right@}
\xydefcsname@{shape [flip]}{\xyshape@flip@}
\xydefcsname@{shape [halfsize]}{\xyshape@halfsize@}
\xydefcsname@{shape [dblsize]}{\xyshape@dblsize@}
\xydefcsname@{shape [vflip]}{\xyshape@vflip@}
\xydefcsname@{shape [hflip]}{\xyshape@hflip@}
\xydef@\preXYtransform@{}
\xydef@\postXYtransform@{}
\xywarnifdefined\preXYtransform@@
\xywarnifdefined\postXYtransform@@
 \gdef\preXYtransform@@{}
 \gdef\postXYtransform@@{}
\xydef@\xy@transform@{}
\xydef@\preShape@@{}
\xydef@\postShape@@{}
\xydef@\modXYtransform@{%
 \ifx\xy@transform@\empty
 \transformDrop@\transformConnect@\resetTransform@\fi
 \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{##1}}%
 \expandafter\next@\expandafter{\preShape@@}%
 \DN@##1{\expandafter\gdef\expandafter\preXYtransform@@\expandafter{%
 \tmp@ ##1}}\expandafter\next@\expandafter{\preXYtransform@@}%
 \DN@##1{\expandafter\def\expandafter\tmp@\expandafter{##1}}%
 \expandafter\next@\expandafter{\postShape@@}%
 \DN@##1{\expandafter\gdef\expandafter\postXYtransform@@\expandafter{%
 \postXYtransform@@ ##1}}\expandafter\next@\expandafter{\tmp@}}%
\xydef@\transformDrop@{\let\xy@transform@=\relax
 \expandafter\def\expandafter\Drop@@\expandafter{%
 \expandafter\preXYtransform@\Drop@@\postXYtransform@}}
\xydef@\transformConnect@{\let\xy@transform@=\relax
 \expandafter\def\expandafter\Connect@@\expandafter{%
 \expandafter\preXYtransform@\Connect@@\postXYtransform@}}
\xydef@\resetTransform@{\gdef\preXYtransform@@{}\gdef\postXYtransform@@{}}
\xydef@\xynametransform@#1{%
 \DN@{\expandafter\gdef\expandafter#1\expandafter{\the\toks@}}\next@ }
\xydef@\xyscalechar@#1@@{\xyscalechars@#1,#1,@@}
\xydef@\xyscalechars@#1,#2,#3@@{%
 \DN@{\xyrescale@(#1,#2)}%
 \dimen@=#1\p@
 \ifdim\dimen@>\z@ \else \ifdim\dimen@<\z@ \else
 \DN@{\xywarning@{invalid scaling factors #1, #2}}%
 \fi\fi \dimen@=#2\p@
 \ifdim\dimen@>\z@ \else \ifdim\dimen@<\z@ \else
 \DN@{\xywarning@{invalid scaling factors #1, #2 }}%
 \fi\fi \next@ }
\xydef@\xyrescale@(#1,#2){%
 \setboxz@h{\xyscale@@{#1}{#2}%
 \dimen@=\ifx-#1\R@c\advance\dimen@-\R@c \dimen@=-\dimen@
 \else#1\L@c \advance\dimen@-\L@c\fi
 \kern\dimen@\boxz@\kern-\dimen@}%
 \R@c=\if-#1\L@c\else#1\R@c\fi
 \L@c=\if-#1\R@c\else#1\L@c\fi
 \U@c=\if-#2\D@c\else#2\U@c\fi
 \D@c=\if-#2\U@c\else#2\D@c\fi }
\xydef@\xyignorescale@(#1,#2){\xywarning@{Ignoring rescale: #1,#2}%
 \setboxz@h{\xyscale@@{#1}{#2}\boxz@}}%
\xydef@\xyshape@halfsize@{\xyrescale@(.5,.5)}
\xydef@\xyshape@dblsize@{\xyrescale@(2,2)}
\xydef@\xyshape@flip@{\xyrescale@(-1,-1)}
\xydef@\xyshape@vflip@{\xyrescale@(1,-1)}
\xydef@\xyshape@hflip@{\xyrescale@(-1,1)}
\xydef@\xyrotatechar@{\bgroup
 \afterDIRECTIONorEMPTY{\xyrotateSizeMod@}{\xyFN@\xySpecialRotate@i}}
\xydef@\xySpecialRotate@i{%
 \ifx \space@\next \expandafter\DN@\space{\xyFN@\xySpecialRotate@i}%
 \else\ifx @\next \let\next@=\xyrotateSizeMod@
 \else\addEQ@\ifx \next
 \addEQ@\DN@##1@@{%
 \expandafter\xynametransform@\csname shape [##1]\endcsname\egroup}%
 \else\ifx !\next \DN@!{\egroup\getSpecialRotate@}%
 \else\ifx *\next \DN@*@@{\egroup\transformDrop@}%
 \else \DN@{\xySpecialRotate@@}%
 \fi\fi\fi\fi\fi \next@ }
\xydef@\getSpecialRotate@{\doSpecialRotate@@}
\xydef@\xyRotate@#1{\xyundefinedRotate@{rotate}{#1}@@}
\xydef@\xySpecialRotate@#1@@{\xyundefinedRotate@{rotate}{#1}@@\egroup}
\xydef@\doSpecialRotate@#1@@{\xyundefinedRotate@{special rotate}{#1}@@}
\xydef@\xyscale@#1#2{\xyundefinedRotate@{scale}{#1,#2}@@}
\xydef@\UnloadRotate@#1{%
 \ifx#1\relax\else\xyunload@{rotation extension}\fi
 \let\xyRotate@@=\xyRotate@
 \let\xySpecialRotate@@=\xySpecialRotate@
 \let\doSpecialRotate@@=\doSpecialRotate@
 \let\xyscale@@=\xyscale@ }
\UnloadRotate@\relax
\xyaddunsupport{rotate}{\UnloadRotate@\relax}
\xydef@\xyrotateSizeMod@ @@{%
 \L@p=\L@c \R@p=\R@c \U@p=\U@c \D@p=\D@c 
 \ifdim\cosDirection\p@>\z@ 
 \R@c=\cosDirection\R@p \L@c=\cosDirection\L@p
 \U@c=\cosDirection\U@p \D@c=\cosDirection\D@p 
 \else
 \R@c=\cosDirection\L@p \L@c=\cosDirection\R@p
 \U@c=\cosDirection\D@p \D@c=\cosDirection\U@p 
 \fi
 \advance\L@c \if-\sinDirection\D@p\else\sinDirection\U@p\fi
 \advance\R@c \if-\sinDirection\U@p\else\sinDirection\D@p\fi
 \advance\U@c \if-\sinDirection\L@p\else\sinDirection\R@p\fi
 \advance\D@c \if-\sinDirection\R@p\else\sinDirection\L@p\fi
 \dimen@ii=\L@c \advance\dimen@ii-\L@p
 \edef\tmp@{\egroup \L@c=\the\L@c \R@c=\the\R@c \U@c=\the\U@c \D@c=\the\D@c
 \dimen@ii=\the\dimen@ii \noexpand\setboxz@h\bgroup
 \noexpand\xyRotate@@{\the\Direction}}\tmp@
 \xydropRotated@ }
\xydef@\xydropRotated@@{%
 \kern\dimen@ii \boxz@ \kern-\dimen@ii \modXYtransform@ \egroup }
\xylet@\xydropRotated@=\xydropRotated@@
\xydef@\xyignoreSizeMod@ @@{\xywarning@{Ignoring rotation}}
\xydef@\xyshape@left@{\xyrotatechar@ v(0,1)@@}
\xydef@\xyshape@right@{\xyrotatechar@ v(0,-1)@@}
\xydef@\xyshearchar@{\xyundefinedRotate@{shearing}}
\xyendinput