summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-08-08 22:54:29 +0000
committerKarl Berry <karl@freefriends.org>2015-08-08 22:54:29 +0000
commit531d43fafa269c546d587eaca6cd14adcd11914f (patch)
tree1883933af984c60254e6d9d1bd955a76748cb827 /Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
parent877e963d44f039783cb9227d90c911866c780961 (diff)
pgf (8aug15)
git-svn-id: svn://tug.org/texlive/trunk@38079 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex82
1 files changed, 70 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
index 83f89b1fa2d..5e13c6cb660 100644
--- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex
@@ -7,7 +7,7 @@
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
-\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.17 2013/10/10 08:53:09 tantau Exp $
+\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoretransformations.code.tex,v 1.20 2015/08/07 10:17:34 cfeuersaenger Exp $
% Position transformations
@@ -58,8 +58,8 @@
% \pgfsettransformentries\aa\ab\ba\bb\shiftx\shifty
\def\pgfgettransformentries#1#2#3#4#5#6{%
\edef#1{\pgf@pt@aa}%
- \edef#2{\pgf@pt@ab}%
- \edef#3{\pgf@pt@ba}%
+ \edef#2{\pgf@pt@ab}% attention: this is (1,0), i.e. the point which is usually labelled 'ba'!
+ \edef#3{\pgf@pt@ba}% attention: this is (0,1), i.e. the point which is usually labelled 'ab'!
\edef#4{\pgf@pt@bb}%
\edef#5{\the\pgf@pt@x}%
\edef#6{\the\pgf@pt@y}%
@@ -97,6 +97,8 @@
\def\pgf@idmatrixtext{1.0,0.0,0.0,1.0}
\def\pgf@zerozerotext{0.0,0.0}
+\def\pgf@one@text{1.0}
+\def\pgf@zero@text{0.0}
% Transformation command
%
@@ -317,10 +319,10 @@
\def\pgftransformreset{%
\pgf@pt@x=0pt%
\pgf@pt@y=0pt%
- \def\pgf@pt@aa{1.0}%
- \def\pgf@pt@ba{0.0}%
- \def\pgf@pt@ab{0.0}%
- \def\pgf@pt@bb{1.0}%
+ \let\pgf@pt@aa\pgf@one@text%
+ \let\pgf@pt@ba\pgf@zero@text%
+ \let\pgf@pt@ab\pgf@zero@text%
+ \let\pgf@pt@bb\pgf@one@text%
\pgf@pt@identitytrue%
}
@@ -332,10 +334,10 @@
% \pgftansformreset
\def\pgftransformresetnontranslations{%
- \def\pgf@pt@aa{1.0}%
- \def\pgf@pt@ba{0.0}%
- \def\pgf@pt@ab{0.0}%
- \def\pgf@pt@bb{1.0}%
+ \let\pgf@pt@aa\pgf@one@text%
+ \let\pgf@pt@ba\pgf@zero@text%
+ \let\pgf@pt@ab\pgf@zero@text%
+ \let\pgf@pt@bb\pgf@one@text%
\pgf@pt@identitytrue%
}
@@ -608,6 +610,62 @@
+
+% Computes transformations adjustments for the current transformation
+% matrix
+%
+% Description:
+%
+% This command is used when you install a transformation matrix that
+% scales everything by a certain factor, but you still wish to draw
+% something with "an absolute size". Suppose for instance that you
+% install a transformation matrix that scales everything by a factor
+% of 4 and you now wish to draw a horizontal line of length 1cm. Then,
+% if you do not reset the transformation matrix, you can draw a line
+% of logical length 2.5mm, which will then get scaled to a line of
+% 1cm.
+%
+% Things get more difficult in case you scale things only, say,
+% vertically. In this case, the adjustement necessary for horizontal
+% lines is different from the one needed for vertical lines.
+%
+% This function computes the necessary scaling factors and puts them
+% in the macros \pgfhorizontaltransformationadjustment and
+% \pgfverticaltransformationadjustment.
+%
+% Note that the "right" way to draw a line of absolute length 1cm in a
+% transformed coordinate system is to first compute the start point
+% and to then reset the transformation matrix. The transofmration
+% adjustments computed here are important only in situations where you
+% cannot do this, for instance when an "outer xsep" must be set.
+
+\def\pgftransformationadjustments{%
+ \ifpgf@pt@identity%
+ \let\pgfhorizontaltransformationadjustment\pgf@one@text%
+ \let\pgfverticaltransformationadjustment\pgf@one@text%
+ \else%
+ {%
+ \pgf@pt@x0pt%
+ \pgf@pt@y0pt%
+ \pgfpointtransformed{\pgfqpoint{1pt}{0pt}}%
+ \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \global\let\pgf@temp@hori\pgfmathresult
+ \pgfpointtransformed{\pgfqpoint{0pt}{1pt}}%
+ \pgfmathveclen@{\pgf@sys@tonumber\pgf@x}{\pgf@sys@tonumber\pgf@y}%
+ \pgfmathreciprocal@{\pgfmathresult}%
+ \global\let\pgf@temp@vert\pgfmathresult
+ \xdef\pgf@marshal@b{\def\noexpand\pgfverticaltransformationadjustment{\pgfmathresult}}
+ }%
+ \let\pgfhorizontaltransformationadjustment\pgf@temp@hori%
+ \let\pgfverticaltransformationadjustment\pgf@temp@vert%
+ \fi%
+}
+
+\let\pgfhorizontaltransformationadjustment\pgf@one@text
+\let\pgfverticaltransformationadjustment\pgf@one@text
+
+
% Low-level transformations
% Causes the current high-level transformation command to be applied
@@ -675,7 +733,7 @@
\let\pgfapproximatenonlineartranslation\relax
\let\pgfapproximatenonlineartransformation\relax
\def\pgftransformnonlinear#1{\pgferror{You need to say
- \string\usepgfmodule{nonlineartransformation} to use nonlinear transformations}}
+ \string\usepgfmodule{nonlineartransformations} to use nonlinear transformations}}
\endinput