From 9467c171fe27adb468829f1b196b2b7b5b3a12ba Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Mon, 4 Feb 2019 17:54:36 +1300 Subject: [PATCH] Add \rawx, \rawy, \rawz to let operation There is an issue with 3D coordinates being projected onto the 2D canvas. There is not way to reverse the projection because a system of two equations (the project 2D coordinates) with three unknowns (the original 3D coordiantes) is underdetermined and unsolvable. Hence I introduce these new little helpers which can be used to access the parsed original coordinates. This works only if you use literal coordinates in the let operation, i.e. \path let \p1=(1,2,3) in ... will work as expected, but \coordinate (A) at (1,2,3); \path let \p1=(A) in ... will not work, because the projection has already been performed when defining the \coordinate. --- tex/generic/pgf/basiclayer/pgfcorepoints.code.tex | 6 +++--- .../tikz/libraries/tikzlibrarycalc.code.tex | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex b/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex index 51f19f20a..cc444926e 100644 --- a/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex +++ b/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex @@ -851,11 +851,11 @@ \def\pgfpointxyz#1#2#3{% \pgfmathparse{#1}% - \let\pgftemp@x=\pgfmathresult% + \global\let\pgftemp@x=\pgfmathresult% \pgfmathparse{#2}% - \let\pgftemp@y=\pgfmathresult% + \global\let\pgftemp@y=\pgfmathresult% \pgfmathparse{#3}% - \let\pgftemp@z=\pgfmathresult% + \global\let\pgftemp@z=\pgfmathresult% \global\pgf@x=\pgftemp@x\pgf@xx% \global\advance\pgf@x by \pgftemp@y\pgf@yx% \global\advance\pgf@x by \pgftemp@z\pgf@zx% diff --git a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex index 561a72530..90819291e 100644 --- a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex +++ b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex @@ -39,6 +39,9 @@ \let\x=\tikz@cc@dox% \let\y=\tikz@cc@doy% \let\n=\tikz@cc@don% + \let\rawx=\tikz@cc@dotempx% + \let\rawy=\tikz@cc@dotempy% + \let\rawz=\tikz@cc@dotempz% \pgfutil@ifnextchar i{\tikz@cc@stop@let}{\tikz@cc@handle@line}% }% \def\tikz@cc@handle@line{% @@ -66,6 +69,9 @@ \expandafter\edef\csname tikz@cc@p@\tikz@cc@coord@name\endcsname{\the\pgf@x,\the\pgf@y}% \expandafter\edef\csname tikz@cc@x@\tikz@cc@coord@name\endcsname{\the\pgf@x}% \expandafter\edef\csname tikz@cc@y@\tikz@cc@coord@name\endcsname{\the\pgf@y}% + \expandafter\edef\csname tikz@cc@tempx@\tikz@cc@coord@name\endcsname{\pgftemp@x}% + \expandafter\edef\csname tikz@cc@tempy@\tikz@cc@coord@name\endcsname{\pgftemp@y}% + \expandafter\edef\csname tikz@cc@tempz@\tikz@cc@coord@name\endcsname{\pgftemp@z}% \pgfutil@ifnextchar,{\tikz@cc@handle@nextline}{\tikz@cc@stop@let}% }% \def\tikz@cc@handle@nextline,{% @@ -79,6 +85,9 @@ \def\tikz@cc@dox#1{\csname tikz@cc@x@#1\endcsname}% \def\tikz@cc@doy#1{\csname tikz@cc@y@#1\endcsname}% \def\tikz@cc@don#1{\csname tikz@cc@n@#1\endcsname}% +\def\tikz@cc@dotempx#1{\csname tikz@cc@tempx@#1\endcsname}% +\def\tikz@cc@dotempy#1{\csname tikz@cc@tempy@#1\endcsname}% +\def\tikz@cc@dotempz#1{\csname tikz@cc@tempz@#1\endcsname}%