Wie dreht man einen Kreis um zwei Achsen?

Wie dreht man einen Kreis um zwei Achsen?

Ich versuche, einen Kreis um zwei Achsen zu drehen. Der Kreis sollte senkrecht zum roten Vektor stehen.

Code:

\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    % xyz axes
    \draw[thick,->] (0,0,0) -- (5,0,0) node[anchor=north east]{$x$};
    \draw[thick,->] (0,0,0) -- (0,5,0) node[anchor=north west]{$y$};
    \draw[thick,->] (0,0,0) -- (0,0,5) node[anchor=north west]{$z$};
    % vector
    \draw[->,red] (0,0,0) -- (4,4,4);
    % center of circle
    \fill (3,3,3) circle (1pt);
    % circle
    \draw (3,3,3) circle (3); % rotation?
\end{tikzpicture}
\end{document}

Ausgabe:

Beispielbild

Ich würde gerne wissen, wie man den Kreis so dreht, dass der rote Vektor und der Kreis senkrecht zueinander stehen. Ich glaube, es ist eine 45°-Drehung um die y-Achse und 45° um die z-Achse, aber wie ist das mit Tikz realisierbar?

Antwort1

Ich würde vorschlagen,tikz-3dplot WennSie möchten unbedingt TikZ verwenden, da es viele der Berechnungen übernimmt, die zum Vortäuschen von 3D mit einem Paket erforderlich sind, das für das Zeichnen in 2D entwickelt wurde.

Zum Beispiel:

\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\tdplotsetrotatedcoords{180}{-90}{-90}
\begin{tikzpicture}[tdplot_main_coords]
  \begin{scope}[tdplot_rotated_coords]
    \draw[thick,->] (0,0,0) -- (5,0,0) node[anchor=north east]{$x$};
    \draw[thick,->] (0,0,0) -- (0,5,0) node[anchor=north west]{$y$};
    \draw[thick,->] (0,0,0) -- (0,0,5) node[anchor=north west]{$z$};
    \draw[->,red] (0,0,0) -- (4,4,4);
    \path [fill] (3,3,3) coordinate (c) circle (1pt);
    \tdplotdrawarc[tdplot_rotated_coords]{(c)}{3}{0}{360}{}{}
  \end{scope}
\end{tikzpicture}
\end{document}

Kreis in 3D

Wenn wir den Kreis schattieren möchten, um mehr Tiefe zu erzeugen, können wir die backgroundsBibliothek verwenden und auf die Zeichenreihenfolge achten. Beispiel:

\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{backgrounds}
\begin{document}
\tdplotsetmaincoords{70}{110}
\tdplotsetrotatedcoords{180}{-90}{-90}
\begin{tikzpicture}[tdplot_main_coords]
  \begin{scope}[tdplot_rotated_coords]
    \draw[thick,->] (0,0,0) coordinate (o) -- (5,0,0) node[anchor=north east]{$x$};
    \draw[thick,->] (o) -- (0,5,0) node[anchor=north west]{$y$};
    \draw[thick,->] (o) -- (0,0,5) node[anchor=north west]{$z$};
    \draw[red] (o) -- (3,3,3) coordinate (c);
    \path [fill] (c) circle (1pt);
    \begin{scope}[on background layer]
      \draw[->,red] (c) -- (4,4,4);
      \tdplotdrawarc[tdplot_rotated_coords, right color=blue!50!cyan, left color=blue!50!cyan!15!white, fill opacity=.25, postaction={top color=blue!50!cyan!15!white, bottom color=blue!50!cyan, fill opacity=.25}]{(c)}{3}{0}{360}{}{}
    \end{scope}
  \end{scope}
\end{tikzpicture}
\end{document}

schattierte Version

verwandte Informationen