%% 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 %% %% 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 %% %% 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