# How to set a user-defined coordinate system globally?

Consider an example like this drawing using a 3d perspective. The package tikz3d defines a new coordinate system 3d, and the coordinates are specified as (3d cs:1,2,3) etc.

Is is possible to set the coordinate system globally for the current scope in order to avoid the prefix 3d cs: in each coordinate? Is there something like every coordinate/.cs={3d}?

• Okay, with this addition the mentioned package is of course no option. – TeXnician Feb 9 '17 at 8:40

The coordinate specification (1,2,3) will eventually be processed by

\pgfpointxyz{1}{2}{3}


You can simply redefine this macro (locally) to implements a different coordinate system.

To be specific, \pgfpointxyz is a macro that reads three numbers and defines \pgf@x to be the desired x-coordinate and \pgf@y to be the desired y-coordinate. (See pgfcorepoints.code.tex line 852-864 for its original definition.)

In this case, where a coordinate system is well-prepared, you may also do

\def\tikz@parse@splitxyz#1#2#3,#4,{%
\def\@next{\tikz@scan@one@point#1(3d cs:{#2},{#3},{#4})}%
}


See tikz.code.tex line 5141-5143 for its original definition.

By the way, there is already a library called 3d, you probably need a new name.

This is a working example. The code of the two tikzpicture are the same. But with different processors they result in different curves.

\documentclass[border=9,tikz]{standalone}
\usetikzlibrary{3d}
\begin{document}

\makeatletter
\def\tikz@parse@splitxyz#1#2#3,#4,{%
}
\tikz{
\draw(0,2,0)foreach\i in{1,...,200}{
--(17*\i,2,\i/80)
};
}
\def\tikz@parse@splitxyz#1#2#3,#4,{%