summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-15 21:38:02 +0000
committerKarl Berry <karl@freefriends.org>2019-11-15 21:38:02 +0000
commit114f0dcb24f1aea5407bfa676ef0dcfb2a60b28d (patch)
treecdefc1ffacbe8f68f47541d10dd5ad6481b0e6b1
parentad0cc2635a7a6ba53d891f339d362a41da71cacb (diff)
tikz-3dtools (15nov19)
git-svn-id: svn://tug.org/texlive/trunk@52805 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.pdfbin0 -> 282508 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.tex387
-rw-r--r--Master/texmf-dist/doc/latex/tikz-3dtools/README.md23
-rw-r--r--Master/texmf-dist/tex/latex/tikz-3dtools/tikzlibrary3dtools.code.tex712
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-pictures.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/tikz-3dtools.tlpsrc0
7 files changed, 1124 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.pdf b/Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.pdf
new file mode 100644
index 00000000000..471194ae312
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.tex b/Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.tex
new file mode 100644
index 00000000000..4463f79613f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/tikz-3dtools/3DToolsManual.tex
@@ -0,0 +1,387 @@
+\documentclass[a4paper]{ltxdoc}
+%\input{pgfmanual-dvipdfm.cfg}
+%\input{../../text-en/pgfmanual-en-main-preamble}
+\usepackage[version=latest]{pgf}
+\usepackage{xkeyval,calc,listings,tikz,fp}
+\usepackage[T1]{fontenc}% big thanks to samcarter!
+\usepackage{makeidx}
+\makeindex
+\usepackage{hyperref}
+\hypersetup{%
+ colorlinks=true,
+ linkcolor=blue,
+ filecolor=blue,
+ urlcolor=blue,
+ citecolor=blue,
+ pdfborder=0 0 0,
+}
+\makeatletter % see https://tex.stackexchange.com/q/33946
+\input{pgfmanual.code} %
+\makeatother %
+\input{pgfmanual-en-macros.tex} % link from
+% /usr/local/texlive/2019/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex
+% or the equivalent on your installation
+\newenvironment{ltxtikzlibrary}[1]{
+ \begin{pgfmanualentry}
+ \pgfmanualentryheadline{%
+ \pgfmanualpdflabel{#1}{}%
+ \textbf{\tikzname\ Library} \texttt{\declare{#1}}}
+ \index{#1@\protect\texttt{#1} library}%
+ \index{Libraries!#1@\protect\texttt{#1}}%
+ \vskip.25em%
+ {{\ttfamily\char`\\usetikzlibrary\char`\{\declare{#1}\char`\}\space\space \char`\%\space\space \LaTeX\space only}}\\[.5em]
+ \pgfmanualbody
+}
+{
+ \end{pgfmanualentry}
+}
+\def\pgfautoxrefs{1}
+\usetikzlibrary{3dtools}
+\begin{document}
+\title{\tikzname\ 3D Tools}
+\author{tallmarmot}
+\date{v1.0}
+\maketitle
+\section{Manual}
+\begin{ltxtikzlibrary}{3dtools}
+ This library provides additional tools to create 3d--like pictures.
+\end{ltxtikzlibrary}
+
+TikZ has the |3d| and |tpp| libraries which deal with the projections of
+three--dimensional drawings. This library provides some means to manipulate
+the coordinates. It supports linear combinations of vectors, vector and scalar
+products.
+
+\noindent\textbf{Note:} Hopefully this library is only temporary and its
+contents will be absorbed in slightly extended versions of the |3d| and |calc|
+libraries.
+
+\subsection{Coordinate computations}
+\label{sec:3DCoordinateComputations}
+
+
+The |3dtools| library has some options and styles for coordinate computations.
+\begin{key}{/tikz/3d parse}
+ Parses and expression and inserts the result in form of a coordinate.
+\end{key}
+\begin{key}{/tikz/3d coordinate}
+ Allow one to define a 3d coordinate from other coordinates.
+\end{key}
+Both keys support both symbolic and explicit coordinates.
+
+\begin{codeexample}[width=6cm]
+\begin{tikzpicture}
+ \path (1,2,3) coordinate (A)
+ (2,3,-1) coordinate (B)
+ (-1,-2,1) coordinate (C)
+ [3d parse={0.25*(1,2,3)x(B)}]
+ coordinate(D)
+ [3d parse={0.25*(C)x(B)}]
+ coordinate(E);
+ \path foreach \X in {A,...,E}
+ {(\X) node[fill,inner sep=1pt,
+ label=above:$\X$]{}};
+\end{tikzpicture}
+\end{codeexample}
+
+Notice that, as of now, only the syntax |\path (1,2,3) coordinate (A);| works,
+i.e.\ |\coordinate (A) at (1,2,3);| does \emph{not} work, but leads to error
+messages.
+
+\begin{codeexample}[width=6cm]
+\begin{tikzpicture}
+ \path (1,2,3) coordinate (A)
+ (2,3,-1) coordinate (B)
+ (-1,-2,1) coordinate (C)
+ [3d coordinate={(D)=0.25*(1,2,3)x(B)},
+ 3d coordinate={(E)=0.25*(C)x(B)},
+ 3d coordinate={(F)=(A)-(B)},];
+ \path foreach \X in {A,...,E}
+ {(\X) node[fill,inner sep=1pt,
+ label=above:$\X$]{}};
+\end{tikzpicture}
+\end{codeexample}
+
+The actual parsings are done by the function |\pgfmathtdparse| that allows one
+to parse 3d expressions. The supported vector operations are |+| (addition $+$),
+|-| (subtraction $-$), |*| (multiplication of the vector by a scalar), |x|
+(vector product $\times$) and |o| (scalar product).
+
+\begin{command}{\pgfmathtdparse{\marg{x}}}
+ Parses 3d expressions.
+\end{command}
+
+In order to pretty-print the result one may want to use |\pgfmathprintvector|,
+and use the math function |TD| for parsing.
+
+\begin{command}{\pgfmathprintvector\marg{x}}
+ Pretty-prints vectors.
+\end{command}
+
+
+\begin{codeexample}[width=6.5cm]
+\pgfmathparse{TD("0.2*(A)
+-0.3*(B)+0.6*(C)")}%
+$0.2\,\vec A-0.3\,\vec B+0.6\,\vec C
+=(\pgfmathprintvector\pgfmathresult)$
+\end{codeexample}
+
+The alert reader may wonder why this works, i.e.\ how would \tikzname\ ``know''
+what the coordinates $A$, $B$ and $C$ are. It works because the coordinates in
+\tikzname\ are global, so they get remembered from the above example.
+
+\paragraph{Warning.} The expressions that are used in the coordinates will only
+be evaluated when they are retrieved. So, if you use, say, random numbers, you
+will get each time a \emph{different} result.
+
+\begin{codeexample}[width=4cm]
+\begin{tikzpicture}
+ \path[overlay] (rnd,rnd,rnd)
+ coordinate (R);
+ \node at (0,1)
+ {\pgfmathparse{TD("(R)")}%
+ $\vec R=(\pgfmathprintvector\pgfmathresult)$};
+ \node at (0,0)
+ {\pgfmathparse{TD("(R)")}%
+ $\vec R=(\pgfmathprintvector\pgfmathresult)$};
+\end{tikzpicture}
+\end{codeexample}
+
+\begin{codeexample}[width=5.2cm]
+\pgfmathparse{TD("(1,0,0)x(0,1,0)")}%
+$(1,0,0)^T\times(0,1,0)^T=
+(\pgfmathprintvector\pgfmathresult)^T$
+\end{codeexample}
+
+
+\begin{codeexample}[width=5.2cm]
+\pgfmathparse{TD("(A)o(B)")}%
+$\vec A\cdot \vec B=
+\pgfmathprintnumber\pgfmathresult$
+\end{codeexample}
+
+
+Notice that, as of now, the only purpose of brackets |(...)| is to delimit
+vectors. Further, the addition |+| and subtraction |-| have a \emph{higher}
+precedence than vector products |x| and scalar products |o|. That is,
+|(A)+(B)o(C)| gets interpreted as $(\vec A+\vec B)\cdot\vec C$, and
+|(A)+(B)x(C)| as $(\vec A+\vec B)\times\vec C$.
+
+
+\begin{codeexample}[width=5.2cm]
+\pgfmathparse{TD("(A)+(B)o(C)")}%
+$(\vec A+\vec B)\cdot\vec C=
+\pgfmathprintnumber\pgfmathresult$
+\end{codeexample}
+
+\begin{codeexample}[width=5.2cm]
+\pgfmathparse{TD("(A)+(B)x(C)")}%
+$(\vec A+\vec B)\times\vec C=
+(\pgfmathprintvector\pgfmathresult)$
+\end{codeexample}
+
+Moreover, any expression can only have either one |o| or one |x|, or none of
+these. Expressions with more of these can be accidentally right.
+
+\subsection{Orthonormal projections}
+\label{sec:3DOrthonormalProjections}
+
+This library can be used together with the |tikz-3dplot| package. It also has
+its own means to install orthonormal projections. Orthonormal projections emerge
+from subjecting 3-dimensional vectors to orthogonal transformations and
+projecting them to 2 dimensions. They are not to be confused with the
+perspective projections, which are more realistic and supported by the |tpp|
+library. Orthonormal projections may be thought of a limit of perspective
+projections at large distances, where large means that the distance of the
+observer is much larger than the dimensions of the objects that get depicted.
+
+\begin{key}{/tikz/3d/install view}
+ Installs a 3d orthonormal projection.
+\end{key}
+
+The initial projection is such that $x$ is right an $y$ is up, as if we had no
+third direction.
+
+\begin{codeexample}[width=2cm]
+\begin{tikzpicture}[3d/install view]
+ \draw[-stealth] (0,0,0) -- (1,0,0)
+ node[pos=1.2] {$x$};
+ \draw[-stealth] (0,0,0) -- (0,1,0)
+ node[pos=1.2] {$y$};
+ \draw[-stealth] (0,0,0) -- (0,0,1)
+ node[pos=1.2] {$z$};
+\end{tikzpicture}
+\end{codeexample}
+
+The 3d-like picture emerge by rotating the view. The conventions for the
+parametrization of the orthogonal rotations in terms of three rotation angles
+$\phi$, $\psi$ and $\theta$ are
+\[ O(\phi,\psi,\theta)=\left(\begin{array}{ccc}
+ s_{\phi}\,c_{\psi}
+& s_{\psi}
+& -s_{\phi}\,c_{\theta}-c_{\phi}\,s_{\psi}\,s_{\theta} \\
+ c_{\phi}\,c_{\theta}-s_{\phi}\,s_{\psi}\,s_{\theta}
+& c_{\psi}\,s_ {\theta}
+& s_{\phi}\,s_{\theta}-c_{\phi}\,c_{\theta}\,s_{\psi} \\
+ -s_{\phi}\,s_{\psi}\,c_{\theta}-c_{\phi}\,s_{\theta}
+& c_{\psi}\,c_{\theta}
+& c_{\psi}\,c_{\theta}\end{array}\right)\;.
+\]
+Here, $c_\phi:=\cos\phi$, $s_\phi:=\sin\phi$ and so on.
+\begin{key}{/tikz/3d/phi (initially 0)}
+ 3d rotation angle.
+\end{key}
+\begin{key}{/tikz/3d/psi (initially 0)}
+ 3d rotation angle.
+\end{key}
+\begin{key}{/tikz/3d/theta (initially 0)}
+ 3d rotation angle.
+\end{key}
+The rotation angles can be used to define the view. The conventions are chosen
+in such a way that they resemble those of the |tikz-3dplot| package, which gets
+widely used.
+
+\begin{codeexample}[width=2.5cm]
+\begin{tikzpicture}[3d/install view={phi=110,psi=0,theta=70}]
+ \draw[-stealth] (0,0,0) -- (1,0,0)
+ node[pos=1.2] {$x$};
+ \draw[-stealth] (0,0,0) -- (0,1,0)
+ node[pos=1.2] {$y$};
+ \draw[-stealth] (0,0,0) -- (0,0,1)
+ node[pos=1.2] {$z$};
+\end{tikzpicture}
+\end{codeexample}
+
+\begin{codeexample}[width=2.5cm]
+\begin{tikzpicture}[3d/install view={phi=110,psi=0,theta=70}]
+ \draw[-stealth] (0,0,0) -- (1,0,0)
+ node[pos=1.2] {$x$};
+ \draw[-stealth] (0,0,0) -- (0,1,0)
+ node[pos=1.2] {$y$};
+ \draw[-stealth] (0,0,0) -- (0,0,1)
+ node[pos=1.2] {$z$};
+\end{tikzpicture}
+\end{codeexample}
+
+\subsection{Predefined pics}
+
+\begin{key}{/tikz/pics/3d circle through 3 points=\meta{options} (initially empty)}
+ Draws a circle through 3 points in 3 dimensions. If the three
+ coordinates are close to linearly dependent, the circle will not be
+ drawn.
+\end{key}
+\begin{key}{/tikz/3d circle through 3 points/A (initially {(1,0,0)})}
+ First coordinate. Can be either symbolic or explicit. Symbolic
+ coordinates need to be defined via
+ |\path (x,y,z) coordinate (name);|.
+\end{key}
+\begin{key}{/tikz/3d circle through 3 points/B (initially {(0,1,0)})}
+ Second coordinate, like above.
+\end{key}
+\begin{key}{/tikz/3d circle through 3 points/C (initially {(0,0,1)})}
+ Third coordinate, like above.
+\end{key}
+\begin{key}{/tikz/3d circle through 3 points/center name (initially {M})}
+ Name of the center coordinate that will be derived.
+\end{key}
+\begin{key}{/tikz/3d circle through 3 points/auxiliary coordinate prefix (initially {tmp})}
+ In \tikzname the coordinates are global. The code for the circle is more
+ comprehensible if named coordinates are introduced. Their names will begin with
+ this prefix. Changing the prefix will allow users to avoid overwritin
+ existing coordinates.
+\end{key}
+
+\begin{codeexample}[width=2.5cm]
+\begin{tikzpicture}[3d/install view={phi=30,psi=0,theta=70}]
+ \foreach \X in {A,B,C}
+ {\pgfmathsetmacro{\myx}{3*(rnd-1/2)}
+ \pgfmathsetmacro{\myy}{3*(rnd-1/2)}
+ \pgfmathsetmacro{\myz}{3*(rnd-1/2)}
+ \path (\myx,\myy,\myz) coordinate (\X);}
+ \path pic{3d circle through 3 points={%
+ A={(A)},B={(B)},C={(C)}}};
+ \foreach \X in {A,B,C,M}
+ {\fill (\X) circle[radius=1.5pt]
+ node[above]{$\X$};}
+\end{tikzpicture}
+\end{codeexample}
+
+To do:
+\begin{itemize}
+ \item transform to plane given by three non-degenerate coordinates
+ \item transform to plane given by normal and one point
+ \item maybe layering/visibility
+\end{itemize}
+
+\subsection{3D--like decorations}
+
+\begin{key}{/tikz/decorations/3d complete coil}
+ 3d--like coil where the front is thicker than the back.
+\end{key}
+
+\begin{key}{/tikz/decorations/3d coil closed}
+ Indicates that the coil is closed.
+\end{key}
+
+
+\begin{codeexample}[width=8cm]
+\begin{tikzpicture}
+\draw[decoration={3d coil color=red,aspect=0.35, segment length=3.1mm,
+amplitude=3mm,3d complete coil},
+decorate] (0,1) -- (0,6);
+\draw[decoration={3d coil color=blue,3d coil opacity=0.9,aspect=0.5,
+segment length={2*pi*3cm/50}, amplitude=5mm,3d complete coil,
+3d coil closed},
+decorate] (5,3.5) circle[radius=3cm];
+\end{tikzpicture}
+\end{codeexample}
+
+
+\end{document}
+
+
+\tdplotsetmaincoords{70}{110}
+\begin{tikzpicture}
+ \begin{scope}[local bounding box=tests,tdplot_main_coords]
+ % to work with this library, you need to define the cordinate
+ % with \path (<x>,<y>,<z>) coordinate (<name>);
+ \path (0,0,0) coordinate (O)
+ (1,2,3) coordinate (A)
+ (2,3,-1) coordinate (B)
+ (-1,-2,1) coordinate (C)
+ % you can use 3d parse (clumsy)
+ [3d parse={0.25*(A)x(B)}] coordinate(D)
+ % you can use 3d coordinate to define a new coordinate from existing ones
+ [3d coordinate={(E)=0.2*(A)-0.3*(B)+0.6*(C)}]
+ [3d coordinate={(H)=0.2*(A)-0.3*(B)+0.6*(C)}];
+ \draw (A) -- (B) -- (C) -- (D) -- (E) -- cycle;
+ \end{scope}
+ %\RawCoord yields the components
+ \edef\tempD{\RawCoord(D)}
+ \edef\tempE{\RawCoord(E)}
+ \edef\tempH{\RawCoord(H)}
+ \node[below right,align=left] at (tests.south west)
+ {$(D)=\tempD$,\\ $(E)=\tempE$,\\ $(H)=\tempH$};
+\end{tikzpicture}
+
+\noindent% clumsy parser
+$\tdparse{(A)+0.3*(B)>(A)+0.3(B)}=(\pgfmathresult)$
+
+\noindent% parsing inside \pgfmathparse. You need to wrap the argument in "..."
+\pgfmathparse{TD("0.2*(A)-0.3*(B)+0.6*(C)")}%
+$0.2\,\vec A-0.3\,\vec B+0.6\vec C=(\pgfmathresult)$
+
+%one can parse with the same parser vector products
+\noindent\pgfmathparse{TD("0.5*(A)x(B)")}%
+$0.5\,\vec A\times\vec B=(\pgfmathresult)$
+%(note, however, that something like (A)x(B)x(C) does NOT work)
+
+%as well as scalar products
+\noindent\pgfmathparse{TD("(A)+(C)o(B)")}%
+$\left(\begin{array}{@{}c@{}}1\\ 0\\ 0\end{array}\right)$
+%(note, however, that + and - have higher precedence than o)\end{document}
+
+
+\end{document}
+
+\endinput
diff --git a/Master/texmf-dist/doc/latex/tikz-3dtools/README.md b/Master/texmf-dist/doc/latex/tikz-3dtools/README.md
new file mode 100644
index 00000000000..15e54b235cf
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/tikz-3dtools/README.md
@@ -0,0 +1,23 @@
+# tikz-3dtools – additional tools to create 3d–like pictures
+
+[![Travis Build Status][travis-svg]][travis-link]
+
+*by [tallmarmot](https://github.com/tallmarmot)*
+
+Ti*k*Z has the `3d` and `tpp` libraries which deal with the
+projections of three-dimensional drawings. This library provides some
+means to manipulate the coordinates. It supports linear combinations
+of vectors, vector and scalar products.
+
+The library is currently maintained by the PGF/Ti*k*Z development team
+at https://github.com/pgf-tikz/tikz-3dtools. Please report bugs on
+the issue tracker at https://github.com/pgf-tikz/tikz-3dtools/issues
+or on the mailing list https://tug.org/mailman/listinfo/pgf-tikz.
+
+This library may be distributed and/or modified
+
+1. under the LaTeX Project Public License 1.3c or later and/or
+2. under the GNU General Public License v2.
+
+[travis-svg]: https://travis-ci.com/pgf-tikz/tikz-3dtools.svg?branch=master
+[travis-link]: https://travis-ci.com/pgf-tikz/tikz-3dtools \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/tikz-3dtools/tikzlibrary3dtools.code.tex b/Master/texmf-dist/tex/latex/tikz-3dtools/tikzlibrary3dtools.code.tex
new file mode 100644
index 00000000000..fd29370c812
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/tikz-3dtools/tikzlibrary3dtools.code.tex
@@ -0,0 +1,712 @@
+% Copyright 2019 by an anonymous marmot
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/generic/pgf/licenses/LICENSE for more details.
+\ProvidesFileRCS{tikzlibrary3dtools.code.tex}
+\usetikzlibrary{3d,decorations,fpu}% to do: ability to switch on and off
+\usepackage{calculator}% maybe drop
+\makeatletter%
+\def\extractpgfversionaux#1.#2.#3|#4#5#6;{\def#4{#1}\def#5{#2}\def#6{#3}}%
+\def\checkversion{%
+\edef\temp{\noexpand\extractpgfversionaux\pgfversion|\noexpand\myu\noexpand\myv\noexpand\myw;}%
+\temp%
+\pgfmathtruncatemacro{\itest}{ifthenelse(10*\myu+\myv<31,0,1)}%
+\ifnum\itest=0%
+\message{You are using a too old version of pgf (\pgfversion). You need at least
+version 3.1.1 to use the features of this library.}%
+\fi}%
+\checkversion%
+\newcommand{\orthmat}[3]{% the entries of this matrix keep track
+\pgfmathparse{cos(#1)*cos(#2)}% of the current transformation
+\xdef\tikz@td@matAA{\pgfmathresult}%
+\pgfmathparse{cos(#2)*sin(#1)}%
+\xdef\tikz@td@matAB{\pgfmathresult}%
+\pgfmathparse{sin(#2)}%
+\xdef\tikz@td@matAC{\pgfmathresult}%
+\pgfmathparse{-cos(#3)*sin(#1)-cos(#1)*sin(#2)*sin(#3)}%
+\xdef\tikz@td@matBA{\pgfmathresult}%
+\pgfmathparse{cos(#1)*cos(#3)-sin(#1)*sin(#2)*sin (#3)}%
+\xdef\tikz@td@matBB{\pgfmathresult}%
+\pgfmathparse{cos(#2)*sin (#3)}%
+\xdef\tikz@td@matBC{\pgfmathresult}%
+\pgfmathparse{sin(#1)*sin(#3)-cos(#1)*cos(#3)*sin(#2)}%
+\xdef\tikz@td@matCA{\pgfmathresult}%
+\pgfmathparse{-cos(#3)*sin(#1)*sin(#2)-cos(#1)*sin(#3)}%
+\xdef\tikz@td@matCB{\pgfmathresult}%
+\pgfmathparse{cos(#2)*cos(#3)}%
+\xdef\tikz@td@matCC{\pgfmathresult}}%
+\tikzset{3d/.cd,phi/.initial=0,psi/.initial=0,theta/.initial=0,
+install view/.style={/utils/exec=\tikzset{3d/.cd,#1}%
+\orthmat{\pgfkeysvalueof{/tikz/3d/phi}}{%
+\pgfkeysvalueof{/tikz/3d/psi}}{\pgfkeysvalueof{/tikz/3d/theta}},%
+/tikz/x={({\tikz@td@matAA*1cm},{\tikz@td@matBA*1cm})},%
+/tikz/y={({\tikz@td@matAB*1cm},{\tikz@td@matBB*1cm})},%
+/tikz/z={({\tikz@td@matAC*1cm},{\tikz@td@matBC*1cm})}}}%
+\def\pgfmathparse@td@FPU#1{\begingroup%
+\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
+\pgfmathparse{#1}%
+\pgfmathsmuggle\pgfmathresult\endgroup}%
+%
+\newlength\pgf@X% not clear if one should use lengths here at all
+\newlength\pgf@Y%
+\newlength\pgf@Z%
+\newlength\pgf@Xa%
+\newlength\pgf@Ya%
+\newlength\pgf@Za%
+\newlength\pgf@Xb%
+\newlength\pgf@Yb%
+\newlength\pgf@Zb%
+\xdef\tikz@td@type{0}%0=linear combination,1=vector product
+\long\def\RawCoord(#1){\csname tikz@dcl@coord@#1\endcsname}%
+\long\def\ParseCoord(#1){%
+\pgfutil@tempcnta=0%
+\pgfutil@for\pgf@tmp:={#1}\do{\advance\pgfutil@tempcnta by1}%
+\ifnum\the\pgfutil@tempcnta=1
+\edef\pgfutil@tmp{\csname tikz@dcl@coord@#1\endcsname}%
+\else%
+\edef\pgfutil@tmp{(#1)}%
+\fi%
+\pgfmathparse@td@FPU{xcomp3(\pgfutil@tmp)}%
+\pgf@X=\pgfmathresult pt%
+\pgfmathparse@td@FPU{ycomp3(\pgfutil@tmp)}%
+\pgf@Y=\pgfmathresult pt%
+\pgfmathparse@td@FPU{zcomp3(\pgfutil@tmp)}%
+\pgf@Z=\pgfmathresult pt}%
+\pgfmathdeclarefunction{TD}{1}{%
+\begingroup%
+\pgfmathtdparse{#1}%
+\pgfmathsmuggle\pgfmathresult\endgroup%
+}%
+% projections
+\pgfmathdeclarefunction{xcomp3}{3}{% x component of a 3-vector
+\begingroup%
+\pgfmathparse@td@FPU{#1}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+\pgfmathdeclarefunction{ycomp3}{3}{% y component of a 3-vector
+\begingroup%
+\pgfmathparse@td@FPU{#2}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+\pgfmathdeclarefunction{zcomp3}{3}{% z component of a 3-vector
+\begingroup%
+\pgfmathparse@td@FPU{#3}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+\pgfmathdeclarefunction{TDx}{1}{% x component of a 3-vector
+\begingroup%
+\edef\mycoord{\RawCoord(#1)}%
+\pgfmathparse@td@FPU{xcomp3\mycoord}%
+\pgfmathsmuggle\pgfmathresult\endgroup}%
+\pgfmathdeclarefunction{TDy}{1}{% x component of a 3-vector
+\begingroup%
+\edef\mycoord{\RawCoord(#1)}%
+\pgfmathparse@td@FPU{ycomp3\mycoord}%
+\pgfmathsmuggle\pgfmathresult\endgroup}%
+\pgfmathdeclarefunction{TDz}{1}{% x component of a 3-vector
+\begingroup%
+\edef\mycoord{\RawCoord(#1)}%
+\pgfmathparse@td@FPU{zcomp3\mycoord}%
+\pgfmathsmuggle\pgfmathresult\endgroup}%
+\def\scalprod#1=#2.#3;{%
+\edef\coordA{\RawCoord#2}%
+\edef\coordB{\RawCoord#3}%
+\pgfmathsetmacro\pgfutil@tmpa{scalarproduct({\coordA},{\coordB})}%
+\edef#1{\pgfutil@tmpa}}%
+\def\spaux#1#2#3#4#5#6{(#1)*(#4)+(#2)*(#5)+(#3)*(#6)}%
+\pgfmathdeclarefunction{scalarproduct}{2}{% scalar product of two 3-vectors
+\begingroup%
+\pgfmathparse@td@FPU{\spaux#1#2}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+% vector product
+% vector product auxiliary functions
+\def\vpauxx#1#2#3#4#5#6{(#2)*(#6)-(#3)*(#5)}%
+\def\vpauxy#1#2#3#4#5#6{(#4)*(#3)-(#1)*(#6)}%
+\def\vpauxz#1#2#3#4#5#6{(#1)*(#5)-(#2)*(#4)}%
+% vector product pgf functions
+\pgfmathdeclarefunction{vpx}{2}{% x component of vector product
+\begingroup%
+\pgfmathparse@td@FPU{\vpauxx#1#2}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+\pgfmathdeclarefunction{vpy}{2}{% y component of vector product
+\begingroup%
+\pgfmathparse@td@FPU{\vpauxy#1#2}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+\pgfmathdeclarefunction{vpz}{2}{% z component of vector product
+\begingroup%
+\pgfmathparse@td@FPU{\vpauxz#1#2}%
+\pgfmathsmuggle\pgfmathresult\endgroup}
+%
+%
+% the following is very much "inspired" by the calc library
+\long\def\pgfmathtdparse#1{% < and > really are placeholders for a later integration
+\begingroup% into calc, which however requires changes both in
+% tikzlibrarycalc.code.tex and in tikz.code.tex
+%
+% tdparse main computation. It's a series of optional factors in front
+% of coordinates. It is very much copied from the calc library.
+%
+\pgf@Xa=0pt% We accumulate the result in here.
+\pgf@Ya=0pt%
+\pgf@Za=0pt%
+\tikz@td@cc@parse+#1%
+}%
+
+\def\tikz@td@cc@parse{%
+\pgfutil@ifnextchar>{%
+% Ok, we found the end...
+\tikz@td@cc@end%
+}
+{\pgfutil@ifnextchar+{%
+% Ok, we found a coordinate...
+\tikz@td@cc@add%
+}{%
+\pgfutil@ifnextchar-{%
+\tikz@td@cc@sub%
+}{%
+\pgfutil@ifnextchar x{%
+\tikz@td@cc@vecprod%
+}{%
+\pgfutil@ifnextchar o{%
+\tikz@td@cc@scalprod%
+}{% \tikzerror{+ or - expected}%
+\tikz@td@cc@end%
+}%
+}%
+}%
+}%
+}%
+}%
+%
+% The end is reached with > at the moment but this should change
+%
+\def\tikz@td@cc@end{%
+\ifcase\tikz@td@type%
+\pgfmathsetmacro{\pgftemp@x}{\pgf@Xa}%
+\pgfmathsetmacro{\pgftemp@y}{\pgf@Ya}%
+\pgfmathsetmacro{\pgftemp@z}{\pgf@Za}%
+\edef\pgfmathresult{\pgftemp@x,\pgftemp@y,\pgftemp@z}%
+\or%
+\pgfmathsetmacro{\myxa}{\pgf@Xa}%
+\pgfmathsetmacro{\myya}{\pgf@Ya}%
+\pgfmathsetmacro{\myza}{\pgf@Za}%
+\pgfmathsetmacro{\myxb}{\pgf@Xb}%
+\pgfmathsetmacro{\myyb}{\pgf@Yb}%
+\pgfmathsetmacro{\myzb}{\pgf@Zb}%
+\pgfmathsetmacro{\pgftemp@x}{\vpauxx{\myxb}{\myyb}{\myzb}{\myxa}{\myya}{\myza}}%
+\pgfmathsetmacro{\pgftemp@y}{\vpauxy{\myxb}{\myyb}{\myzb}{\myxa}{\myya}{\myza}}%
+\pgfmathsetmacro{\pgftemp@z}{\vpauxz{\myxb}{\myyb}{\myzb}{\myxa}{\myya}{\myza}}%
+%\typeout{P1=(\myxb,\myyb,\myzb),P2=(\myxa,\myya,\myza),P1xP2=(\pgftemp@x,\pgftemp@y,\pgftemp@z)}%
+\edef\pgfmathresult{\pgftemp@x,\pgftemp@y,\pgftemp@z}%
+\or%
+\pgfmathsetmacro{\myxa}{\pgf@Xa}%
+\pgfmathsetmacro{\myya}{\pgf@Ya}%
+\pgfmathsetmacro{\myza}{\pgf@Za}%
+\pgfmathsetmacro{\myxb}{\pgf@Xb}%
+\pgfmathsetmacro{\myyb}{\pgf@Yb}%
+\pgfmathsetmacro{\myzb}{\pgf@Zb}%
+\pgfmathparse@td@FPU{\myxa*\myxb+\myya*\myyb+\myza*\myzb}%
+%\typeout{P1=(\myxb,\myyb,\myzb),P2=(\myxa,\myya,\myza),P1.P2=(\pgmfmathresult)}%
+\fi%
+%\message{result = (\pgftemp@x,\pgftemp@y,\pgftemp@z)=\pgfmathresult^^J}%
+\xdef\tikz@td@type{0}% reset type to linear combination
+\pgfmathsmuggle\pgfmathresult\endgroup}%
+%
+\def\tikz@td@cc@add+{%
+\def\tikz@td@cc@factor{1}%
+\tikz@td@cc@factororcoordinate%
+}%
+\def\tikz@td@cc@sub-{%
+\def\tikz@td@cc@factor{-1}%
+\tikz@td@cc@factororcoordinate%
+}%
+\def\tikz@td@cc@vecprod x{%
+%\message{Ah, a vector product^^J}%
+\xdef\tikz@td@type{1}%
+\pgf@Xb=\pgf@Xa% store current vector in b
+\pgf@Yb=\pgf@Ya%
+\pgf@Zb=\pgf@Za%
+\pgf@Xa=0pt% reset a
+\pgf@Ya=0pt%
+\pgf@Za=0pt%
+\def\tikz@td@cc@factor{1}%
+\tikz@td@cc@factororcoordinate%
+}%
+\def\tikz@td@cc@scalprod o{%
+%\message{Ah, a scalar product^^J}%
+\xdef\tikz@td@type{2}%
+\pgf@Xb=\pgf@Xa% store current vector in b
+\pgf@Yb=\pgf@Ya%
+\pgf@Zb=\pgf@Za%
+\pgf@Xa=0pt% reset a
+\pgf@Ya=0pt%
+\pgf@Za=0pt%
+\def\tikz@td@cc@factor{1}%
+\tikz@td@cc@factororcoordinate%
+}%
+%
+% Check for a factor: If we see a (, its a coordinate...
+%
+\def\tikz@td@cc@factororcoordinate{%
+\pgfutil@ifnextchar({%)
+% Ok, found coordinate
+\tikz@td@cc@coordinate%
+}{%
+\tikz@td@cc@parse@factor%
+}%
+}%
+%
+% ... otherwise it's a factor. It ends at ...*(
+%
+\def\tikz@td@cc@parse@factor#1*({%
+\pgfmathparse@td@FPU{#1*\tikz@td@cc@factor}%
+\let\tikz@td@cc@factor=\pgfmathresult%
+\tikz@td@cc@coordinate(%)
+}%
+\def\tikz@td@cc@coordinate(#1){%
+\ParseCoord(#1)%
+\advance\pgf@Xa by\tikz@td@cc@factor\pgf@X
+\advance\pgf@Ya by\tikz@td@cc@factor\pgf@Y
+\advance\pgf@Za by\tikz@td@cc@factor\pgf@Z
+\tikz@td@cc@parse%
+}%
+\tikzset{declare function={torusx(\u,\v,\R,\r)=cos(\u)*(\R + \r*cos(\v));
+torusy(\u,\v,\R,\r)=(\R + \r*cos(\v))*sin(\u);
+torusz(\u,\v,\R,\r)=\r*sin(\v);
+vcrit1(\u,\th)=atan(tan(\th)*sin(\u));% first critical v value
+vcrit2(\u,\th)=180+atan(tan(\th)*sin(\u));% second critical v value
+vtest(\u,\v,\az,\el)=sin(-vcrit1(\u-\az,\el)+\v);
+disc(\th,\R,\r)=((pow(\r,2)-pow(\R,2))*pow(cot(\th),2)+%
+pow(\r,2)*(2+pow(tan(\th),2)))/pow(\R,2);% discriminant
+umax(\th,\R,\r)=ifthenelse(disc(\th,\R,\r)>0,asin(sqrt(abs(disc(\th,\R,\r)))),0);
+}}%
+%
+\tikzset{3d parse/.style={/utils/exec=\pgfmathtdparse{#1},%
+insert path={(\pgfmathresult)}},3d coordinate/.style args={#1=#2}{%
+/utils/exec=\pgfmathtdparse{#2},%
+insert path={(\pgfmathresult) coordinate #1}}}%
+\def\pgfmathprintvector#1{%
+\pgfutil@tempcnta=0%
+\pgfutil@for\pgf@tmp:={#1}\do{\advance\pgfutil@tempcnta by1}%
+\pgfutil@tempcntb=1%
+\pgfutil@for\pgf@tmp:={#1}\do{\advance\pgfutil@tempcntb by1%
+\ifnum\the\pgfutil@tempcntb<\the\pgfutil@tempcnta
+\pgfmathprintnumber\pgf@tmp,%
+\else
+\pgfmathprintnumber\pgf@tmp
+\fi}%
+}%
+%%
+%% predefined pics
+% based on https://en.wikipedia.org/wiki/Circumscribed_circle
+\tikzset{pics/3d circle through 3 points/.style={code={%
+ \tikzset{3d/circle through 3 points/.cd,#1}%
+ \edef\temp{\noexpand\path[overlay,
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)=\pgfkeysvalueof{/tikz/3d/circle through 3 points/A}-\pgfkeysvalueof{/tikz/3d/circle through 3 points/C}},
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)=\pgfkeysvalueof{/tikz/3d/circle through 3 points/B}-\pgfkeysvalueof{/tikz/3d/circle through 3 points/C}},
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}c)=\pgfkeysvalueof{/tikz/3d/circle through 3 points/A}-\pgfkeysvalueof{/tikz/3d/circle through 3 points/B}},
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)=(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)x(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)}];}%
+ \temp
+ \pgfmathsetmacro{\lengthn}{sqrt(TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)"))}
+ \ifdim\lengthn pt<0.02pt
+ \message{The points are (almost) on a line. Circle cannot be determined.}
+ \else
+ \pgfmathsetmacro{\tmpradius}{sqrt(TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)"))*%
+ sqrt(TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)"))*sqrt(TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}c)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}c)"))/%
+ (2*\lengthn)}
+ \pgfmathsetmacro{\coeffa}{-1*TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)")/(2*TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)"))}
+ \pgfmathsetmacro{\coeffb}{TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)")/(2*TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)"))}
+ \edef\temp{%
+ \noexpand\path[overlay,3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}u)=\coeffa*(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)x(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)},
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}v)=\coeffb*(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}b)x(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)}];
+ \noexpand\path[3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/center name})=\pgfkeysvalueof{/tikz/3d/circle through 3 points/C}+(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}u)+(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}v)}];
+ }%
+ \temp
+ \pgfmathsetmacro{\normalizationa}{1/sqrt(TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)"))}
+ \pgfmathsetmacro{\normalizationn}{1/sqrt(TD("(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)o(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)"))}
+ \edef\temp{%
+ \noexpand\path[overlay,3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)=\normalizationa*(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)},
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)=\normalizationn*(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)},
+ 3d coordinate={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}c)=(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)x(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}n)}];
+ }%
+ \temp
+ \edef\temp{%
+ \noexpand\begin{scope}[plane x={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}a)},plane y={(\pgfkeysvalueof{/tikz/3d/circle through 3 points/auxiliary coordinate prefix}c)},canvas is plane]
+ \noexpand\draw[pic actions] (\pgfkeysvalueof{/tikz/3d/circle through 3 points/center name}) circle[radius=\tmpradius];
+ \noexpand\end{scope}}%
+ \temp
+ \fi
+}},3d/circle through 3 points/.cd,A/.initial={(1,0,0)},B/.initial={(0,1,0)},
+C/.initial={(0,0,1)},
+auxiliary coordinate prefix/.initial=tmp,center name/.initial=M}%
+%%
+%% decorations
+%%
+\newif\ifcoil@closed%
+\pgfkeys{%%
+/pgf/decoration/.cd,%
+3d coil color/.store in=\TDCoilColor, %
+3d coil color/.initial=black,%
+3d coil color=black,%
+3d coil width/.store in=\TDCoilWidth, %
+3d coil width/.initial=0.4pt,%
+3d coil width=0.4pt,%
+3d coil dist/.store in=\TDCoilDist, %
+3d coil dist/.initial=0.6pt,%
+3d coil dist=0.6pt,%
+3d coil opacity/.store in=\TDCoilOpacity, %
+3d coil opacity/.initial=1,%
+3d coil opacity=1,%
+3d coil closed/.code=\coil@closedtrue%
+}%
+% https://tex.stackexchange.com/a/219088/121799%
+\tikzset{get stroke color/.code={%%
+ \expandafter\global% Jump over, now we have \global%
+ \expandafter\let% Jump over now we have \global\let%
+ \expandafter\pgfsavedstrokecolor% Jump we have \global\let\pgf...%
+ \csname\string\color@pgfstrokecolor\endcsname% Finally expand this and put it at the end %
+ }, % \global\let\pgf...{} in expanded form %
+ restore stroke color/.code={\pgf@setstrokecolor#1},%
+}%
+\def\pgfpoint@onthreedcoil#1#2#3{%%
+ \pgf@x=#1\pgfdecorationsegmentamplitude%%
+ \pgf@x=\pgfdecorationsegmentaspect\pgf@x%%
+ \pgf@y=#2\pgfdecorationsegmentamplitude%%
+ \pgf@xa=0.083333333333\pgfdecorationsegmentlength%%
+ \advance\pgf@x by#3\pgf@xa%%
+ \advance\pgf@x by-\generaloffset pt%%
+}%
+% coil decoration%
+%%
+% Parameters: \pgfdecorationsegmentamplitude, \pgfdecorationsegmentlength,%
+\pgfdeclaredecoration{3d complete coil}{initial}%
+{ %
+ \state{initial}[width=0.5*\pgfdecorationsegmentlength,%
+ next state=coil, persistent precomputation={% from https://tex.stackexchange.com/a/25689/121799%
+ \pgfmathsetmacro\matchinglength{\pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}%
+ \setlength{\pgfdecorationsegmentlength}{\matchinglength pt}%
+ \tikzset{get stroke color}%
+ \pgfmathsetmacro{\generaloffset}{\pgfdecorationsegmentlength}%
+ \pgfmathsetmacro{\initialoffset}{1.5*\pgfdecorationsegmentlength}%
+ \pgfmathsetmacro{\auxoffset}{2.5*\pgfdecorationsegmentlength}%
+ }] { %
+ % line in the back%
+ %%
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ \ifcoil@closed%
+ \begingroup%
+ \def\generaloffset{\auxoffset}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{1.555}{ 1 }{16}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0.555}{17}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0 }{18}}%
+ \pgfcoordinate{TD@coilast}{\pgfpoint@onthreedcoil{2 }{ 0 }{18}}%
+ \pgfcoordinate{TD@coilfirst}{\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ \pgfusepath{stroke} %
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \endgroup%
+ \fi%
+ \begingroup %%
+ \def\generaloffset{\initialoffset}%
+ \ifcoil@closed%
+ \pgfpathmoveto{\pgfpointanchor{TD@coilast}{center}}%
+ \else%
+ \pgfpathmoveto{\pgfpointorigin}%
+ \fi%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{2 }{-0.555}{7}}%
+ {\pgfpoint@onthreedcoil{1.555}{-1 }{8}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke} %
+ %%
+ % white background for front thick part%
+ %%
+ \pgfsetstrokeopacity{1}%
+ \pgfsetstrokecolor{white}%
+ \pgfsetfillcolor{white}%
+ \pgfsetlinewidth{1.5*\TDCoilWidth+1.5*\TDCoilDist}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ % draw forward%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ % draw the curve back%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ % %
+ % draw the thick foreground path%
+ %%
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ % forward shifted +%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ % draw the curve back shfted -%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{1.555}{ 1 }{16}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0.555}{17}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0 }{18}}%
+ \pgfcoordinate{TD@coilast}{\pgfpoint@onthreedcoil{2 }{ 0 }{18}} %
+ \pgfusepath{stroke} %
+ \endgroup%
+ }%
+ \state{coil}[switch if less than=%%
+ 1.9*\pgfdecorationsegmentlength to last,%
+ width=+\pgfdecorationsegmentlength]%
+ { % line in the back%
+ %%
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfpathmoveto{\pgfpointanchor{TD@coilast}{center}}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{2 }{-0.555}{7}}%
+ {\pgfpoint@onthreedcoil{1.555}{-1 }{8}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke} %
+ %%
+ % white background for front thick part%
+ %%
+ \pgfsetstrokeopacity{1}%
+ \pgfsetstrokecolor{white}%
+ \pgfsetfillcolor{white}%
+ \pgfsetlinewidth{1.5*\TDCoilWidth+1.5*\TDCoilDist}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ % draw forward%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ % draw the curve back%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ % %
+ % draw the thick foreground path%
+ %%
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ % forward shifted +%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ % draw the curve back shfted -%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{1.555}{ 1 }{16}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0.555}{17}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0 }{18}}%
+ \pgfusepath{stroke} %
+ \pgfcoordinate{TD@coilast}{\pgfpoint@onthreedcoil{2 }{ 0 }{18}} %
+ }%
+ \state{last}[next state=final]%
+ { % line in the back%
+ %%
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfpathmoveto{\pgfpointanchor{TD@coilast}{center}}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{2 }{-0.555}{7}}%
+ {\pgfpoint@onthreedcoil{1.555}{-1 }{8}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke} %
+ % %
+ % draw the thick foreground path%
+ %%
+ \ifcoil@closed %\pgfpointanchor{TD@coilfirst}{center}%
+ %%
+ % white background for front thick part%
+ %%
+ \pgfsetstrokeopacity{1}%
+ \pgfsetstrokecolor{white}%
+ \pgfsetfillcolor{white}%
+ \pgfsetlinewidth{1.5*\TDCoilWidth+1.5*\TDCoilDist}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ % draw forward%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpointanchor{TD@coilfirst}{center}}%
+ % draw the curve back%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ % forward shifted +%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpointanchor{TD@coilfirst}{center}}%
+ % draw the curve back shifted %
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ \else%
+ %%
+ % white background for front thick part%
+ %%
+ \pgfsetstrokeopacity{1}%
+ \pgfsetstrokecolor{white}%
+ \pgfsetfillcolor{white}%
+ \pgfsetlinewidth{1.5*\TDCoilWidth+1.5*\TDCoilDist}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ % draw forward%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ % draw the curve back%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ \pgfsetstrokecolor{\TDCoilColor}%
+ \pgfsetfillcolor{\TDCoilColor}%
+ \pgfsetstrokeopacity{\TDCoilOpacity}%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{3}}%
+ \pgfsetlinewidth{\TDCoilWidth} %
+ % forward shifted +%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{11.25}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{12.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{13.25}}%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14.25}}%
+ {\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ % draw the curve back shifted %
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0.445}{ 1 }{14}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0.555}{12.75}}%
+ {\pgfpoint@onthreedcoil{0 }{ 0 }{11.5}}%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{0 }{-0.555}{10.75}}%
+ {\pgfpoint@onthreedcoil{0.445}{-1 }{10}}%
+ {\pgfpoint@onthreedcoil{1 }{-1 }{9}}%
+ \pgfusepath{stroke,fill} %
+ \fi%
+ \pgfpathmoveto{\pgfpoint@onthreedcoil{1 }{ 1 }{15}}%
+ \ifcoil@closed %TD@coilfirst%
+ \else%
+ \pgfpathcurveto%
+ {\pgfpoint@onthreedcoil{1.555}{ 1 }{16}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0.555}{17}}%
+ {\pgfpoint@onthreedcoil{2 }{ 0 }{18}}%
+ \fi%
+ \pgfusepath{stroke} %
+ %\pgfcoordinate{TD@coilast}{\pgfpoint@onthreedcoil{2 }{ 0 }{18}} %
+ }%
+ \state{final}%
+ {%
+ \pgfpathmoveto{\pgfpointdecoratedpathlast}%
+ \tikzset{restore stroke color/.expand once=\pgfsavedstrokecolor}%
+ }%
+}%
+\makeatother
+\endinput
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 54069e9e02c..0ad9af7f4d6 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -684,7 +684,7 @@ my @TLP_working = qw(
thinsp thmbox thmtools threadcol threeddice threeparttable threeparttablex
thuaslogos thucoursework thumb thumbpdf thumbs thumby thuthesis
ticket ticollege
- tikz-bayesnet tikz-cd tikz-3dplot tikz-dependency tikz-dimline
+ tikz-bayesnet tikz-cd tikz-3dplot tikz-3dtools tikz-dependency tikz-dimline
tikz-feynhand tikz-feynman tikz-imagelabels tikz-inet
tikz-kalender tikz-karnaugh tikz-ladder tikz-layers
tikz-nef tikz-network tikz-opm tikz-optics tikz-palattice tikz-qtree
diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
index 70b695362ba..149424555c4 100644
--- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc
@@ -143,6 +143,7 @@ depend texdraw
depend ticollege
depend tipfr
depend tikz-3dplot
+depend tikz-3dtools
depend tikz-bayesnet
depend tikz-cd
depend tikz-dependency
diff --git a/Master/tlpkg/tlpsrc/tikz-3dtools.tlpsrc b/Master/tlpkg/tlpsrc/tikz-3dtools.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/tikz-3dtools.tlpsrc