2

Overview

So say I want an arc between the x and z axis in the same way the following creates an arc between the x and y axis (MVCE):

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}
  \begin{tikzpicture}
    \tikzset{
      x={(0:1cm)},y={(50:0.7cm)},z={(90:1cm)}
    }
    \draw[->] (0,0,0) --++ (1,0,0) node[right]{$x$};
    \draw[->] (0,0,0) --++ (0,1,0) node[right]{$y$};
    \draw[->] (0,0,0) --++ (0,0,1) node[right]{$z$};
    \draw (0,0,0) ++(0:.3) arc (0:90:.3);
  \end{tikzpicture}
\end{document}

Arc between x and y axis

One solution to this exact problem is to do scope and tell arc that the y-axis is the z-axis.

    \begin{scope}
      \tikzset{y=(90:1cm)}
      \draw (0,0,0) ++(0:.3) arc (0:90:.3);
    \end{scope}

The problem

However, I need this more generic since I don't necessarily know how the y-axis is defined, so I'm looking for a way to do, essentially this:

    \begin{scope}
      \switchYZAxes
      \draw (0,0,0) ++(0:.3) arc (0:90:.3);
    \end{scope}

or

    \begin{scope}
      \tikzset{y=\theZAxis}
      \draw (0,0,0) ++(0:.3) arc (0:90:.3);
    \end{scope}

The latter is problematic because it seems like I can't send polar coordinates to the \tikszet via a macro (which is the background for this question).

Any ideas? Thanks :)

2

With \usetikzlibrary{3d} you can use:

\begin{scope}[canvas is xy plane at z=0, blue, thick]
    \draw (0:0.3) arc (0:90:0.3);
\end{scope}

\begin{scope}[canvas is yz plane at x=0, red, thick]
    \draw (0:0.3) arc (0:90:0.3);
\end{scope}

which yields:

enter image description here

Code:

\documentclass[border=1mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{3d}

\begin{document}
  \begin{tikzpicture}
    \tikzset{
      x={(0:1cm)},y={(50:0.7cm)},z={(90:1cm)}
    }
    \draw[->] (0,0,0) --++ (1,0,0) node[right]{$x$};
    \draw[->] (0,0,0) --++ (0,1,0) node[right]{$y$};
    \draw[->] (0,0,0) --++ (0,0,1) node[right]{$z$};

    %\draw (0,0,0) ++(0:.3) arc (0:90:.3);
    \begin{scope}[canvas is xy plane at z=0, blue, thick]
        \draw (0:0.3) arc (0:90:0.3);
    \end{scope}
    \begin{scope}[canvas is yz plane at x=0, red, thick]
        \draw (0:0.3) arc (0:90:0.3);
    \end{scope}
    
    \end{tikzpicture}
\end{document}
2
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
  \tikzset{
    x={(0:1cm)},y={(50:0.7cm)},z={(90:1cm)}
  }

  \draw[->] (0,0,0) --++ (1,0,0) node[right]{$x$};
  \draw[->] (0,0,0) --++ (0,1,0) node[right]{$y$};
  \draw[->] (0,0,0) --++ (0,0,1) node[right]{$z$};
  \draw (0,0,0) ++(0:.3) arc (0:90:.3);

  \def\rad{0.3}
  \coordinate (A) at (\rad, 0, 0);
  \coordinate (B) at (0, 0, \rad);
  \draw[red] (A) edge[in = 0, out = 90] (B);
\end{tikzpicture}
\end{document}

enter image description here

1

I'd recommend tikz-3dplot for that. You only need to draw the arcs in rotated planes. (The first scope is not necessary here, but I put it in case you want to extend the code.)

\documentclass[tikz,border=3.14pt]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{20}
\begin{tikzpicture}[tdplot_main_coords,font=\sffamily]
    \draw[->] (0,0,0) --++ (1,0,0) node[right]{$x$};
    \draw[->] (0,0,0) --++ (0,1,0) node[right]{$y$};
    \draw[->] (0,0,0) --++ (0,0,1) node[right]{$z$};
\tdplotsetrotatedcoords{0}{0}{0}
\begin{scope}[tdplot_rotated_coords]
\draw[red] (0.3,0,0) arc (0:90:0.3);
\end{scope}
\tdplotsetrotatedcoords{0}{90}{90}
\begin{scope}[tdplot_rotated_coords]
\draw[blue] (0.3,0,0) arc (0:90:0.3);
\end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.