# Extract coordinates from 3D point

How do I extract coordinates from a three-dimensional point defined when using tikz-3dplot? I would like to perform some calculations on these (more specifically a cross-product of two vectors), but it seemed to be stumped on the \z1 coordinate (Undefined control sequence), as illustrated with the following example:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{tikz-3dplot}
\begin{document}
\begin{figure}
\tdplotsetmaincoords{0}{0}
\begin{tikzpicture}[tdplot_main_coords]
\coordinate (A) at (1,2,3);
\path let \p1=(A) in (\z1,\y1,\x1) coordinate (B);
\end{tikzpicture}
\end{figure}
\end{document}

-
The coordinates you extract using the let syntax are two-dimensional canvas coordinates, not the logical three-dimensional ones, unfortunately. –  Jake May 7 '12 at 16:50
@Jake: I am not bound to using \path let; if there is any other ways to extract the logical coordinates (so that they can be used in e.g. \pgfmathresult), I am open for that, too. –  RolKau May 7 '12 at 16:52
This is not directly possible. TikZ converts coordinates to 2D at the time they are processed and then forgets how they were specified. So (A) refers to the 2D point that (1,2,3) transforms to. I have developed some code that allows TikZ to remember 3D coordinate information. It is available on the TeX-SX launchpad page (bazaar.launchpad.net/~tex-sx/tex-sx/development/files). Might that be of some help? It was used in answering another question here: tex.stackexchange.com/a/52627/86 where you can see some examples. –  Loop Space May 19 '12 at 18:17
@AndrewStacey Perhaps make your comment an answer? –  Joseph Wright Aug 6 '12 at 10:18

When TikZ reads in a coordinate specification, it converts it straight-away to its internal standard form. This means that it does not remember anything about how that coordinate was specified. (The only time that I know of where this is not strictly true is with the end point of a to path where the end coordinate is passed as-is to the to path construction). In particular, when TikZ encounters a coordinate of the form (1,2,3) then it converts it there and then to 1*x-vector + 2*y-vector + 3*z-vector. When TikZ/PGF remembers a node's position, it remembers just the resulting. So what you are asking for is not possible with ordinary TikZ/PGF.
Unfortunately, it certainly isn't advanced enough to work with the let syntax. So it wouldn't completely fit your requirements.