%% xyrotate.tex from $Id: xyrotate.doc,v 2.12 1994/10/25 03:01:14 ross Exp $ %% %% XY-pic ``Rotate and Scale extension'' option. %% Copyright (c) 1993-1994 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-1994 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: 2.12 $}% {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@ } \xyrequire{line} \xycatcodes \xydefcsname@{*shapechar@@@}#1{\xyrotatechar@#1@@}% \xydefcsname@{*shapechar@<@}#1{\xyshearchar@{#1}@@}% \xydefcsname@{*shapechar@*@}#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@\xyshearchar@{\xyundefinedRotate@{shearing}} \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@\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@}}% \def\modXYtransform@{} \xydef@\transformDrop@{\let\xy@transform@=\relax \expandafter\def\expandafter\Drop@@\expandafter{% \expandafter\preXYtransform@\Drop@@\postXYtransform@}} \xydef@\resetTransform@{\gdef\preXYtransform@@{}\gdef\postXYtransform@@{}} \xydef@\xynametransform@#1{% \expandafter\def\expandafter\tmp@\expandafter{\preXYtransform@@}% \DN@##1{\def\tmp@{\gdef\preXYtransform@@{##1}}}% \expandafter\next@\expandafter{\preXYtransform@@}% \DN@##1{\expandafter\def\expandafter#1\expandafter{\tmp@ \gdef\postXYtransform@@{##1}}}% \expandafter\next@\expandafter{\postXYtransform@@}% \DN@{}} \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\Rc\advance\dimen@-\Rc \dimen@=-\dimen@ \else#1\Lc \advance\dimen@-\Lc\fi \kern\dimen@\boxz@\kern-\dimen@}% \Rc=\if-#1\Lc\else#1\Rc\fi \Lc=\if-#1\Rc\else#1\Lc\fi \Uc=\if-#2\Dc\else#2\Uc\fi \Dc=\if-#2\Uc\else#2\Dc\fi } \xydef@\xyignorescale@(#1,#2){\xywarning@{Ignoring rescale: #1,#2}% \setboxz@h{\xyscale@@{#1}{#2}\boxz@}}% \xydef@\xyscale@@#1#2{\xyundefinedRotate@{scale}{#1,#2}@@} \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@}} \xydef@\xySpecialRotate@{% \ifx \space@\next \expandafter\DN@\space{\xyFN@\xySpecialRotate@}% \else\ifx @\next \let\next@=\xyrotateSizeMod@ \else\addEQ@\ifx \next \addEQ@\DN@##1@@{\transformDrop@ \expandafter\xynametransform@\csname *shape@##1@\endcsname}% \else\ifx !\next \DN@!{\getSpecialRotate@}% \else\ifx *\next \DN@*{\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}@@} \xydef@\doSpecialRotate@#1@@{\xyundefinedRotate@{special rotate}{#1}@@} \xydef@\xyrotateSizeMod@ @@{% \Lp=\Lc \Rp=\Rc \Up=\Uc \Dp=\Dc \ifdim\cosDirection\p@>\z@ \Rc=\cosDirection\Rp \Lc=\cosDirection\Lp \Uc=\cosDirection\Up \Dc=\cosDirection\Dp \else \Rc=\cosDirection\Lp \Lc=\cosDirection\Rp \Uc=\cosDirection\Dp \Dc=\cosDirection\Up \fi \advance\Lc \if-\sinDirection\Dp\else\sinDirection\Up\fi \advance\Rc \if-\sinDirection\Up\else\sinDirection\Dp\fi \advance\Uc \if-\sinDirection\Lp\else\sinDirection\Rp\fi \advance\Dc \if-\sinDirection\Rp\else\sinDirection\Lp\fi \dimen@ii=\Lc \advance\dimen@ii-\Lp \edef\tmp@{\egroup \Lc=\the\Lc \Rc=\the\Rc \Uc=\the\Uc \Dc=\the\Dc \dimen@ii=\the\dimen@ii \noexpand\setboxz@h\bgroup \noexpand\xyRotate@@{\the\Direction}}\tmp@ \kern\dimen@ii \boxz@ \kern-\dimen@ii \egroup } \xydef@\xyignoreSizeMod@ @@{\xywarning@{Ignoring rotation}} \xydef@\xyshape@left@{\xyrotatechar@ v(0,1)@@} \xydef@\xyshape@right@{\xyrotatechar@ v(0,-1)@@} \xyendinput