tikz 2D rotieren für 3D Perspektive der Achsen

Antwort erstellen


Diese Frage dient dazu, das automatisierte Versenden von Formularen durch Spam-Bots zu verhindern.
Smilies
:D :) :( :o :shock: :? 8) :lol: :-x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode ist eingeschaltet
[img] ist eingeschaltet
[flash] ist ausgeschaltet
[url] ist eingeschaltet
Smilies sind eingeschaltet

Die letzten Beiträge des Themas

Ich habe die Datenschutzerklärung gelesen und bin damit einverstanden.

   

Wenn du eine Datei oder mehrere Dateien anhängen möchtest, gib die Details unten ein.

Ansicht erweitern Die letzten Beiträge des Themas: tikz 2D rotieren für 3D Perspektive der Achsen

von godi » Di 2. Okt 2018, 12:28

Hallo,
ich habe eine Lösung gefunden, indem ich alle Rotationen mit tikz-3Dplot ausführe und das Rechteck mit Linien gezeichnet habe. Das Rechteck hat sich sonst nicht gedreht.
\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-3dplot}
        
\begin{document}

\tdplotsetmaincoords{0}{0}

\begin{tikzpicture} [tdplot_main_coords, thick, scale=10]

% Coordinate system:
\draw[gray, <->] (-0.5,0) node[below]{$-x$} -- (0.5,0) node[below]{$x$};
\draw[gray, <->] (0,-0.5) node[left]{$-y$} -- (0, 0.5) node[left]{$y$};

\draw (0.26,-0.26) circle (0.21);

\tdplotsetrotatedcoords{-45}{0}{0}
\begin{scope}[tdplot_rotated_coords]
\draw [fill] (0,0.015) -- (0.155,0.015) -- (0.155,-0.015) -- (0,-0.015) -- cycle;
\draw [fill] ({0.26*sqrt(2)},0.0) ellipse (.20 and .02);
\end{scope}

\end{tikzpicture}

\tdplotsetmaincoords{45}{15}

\begin{tikzpicture} [tdplot_main_coords, thick, scale=10]

% Coordinate system:
\draw[gray, <->] (-0.5,0,0) node[below]{$-x$} -- (0.5,0) node[below]{$x$};
\draw[gray, <->] (0,-0.5,0) node[left]{$-y$} -- (0,0.5,0) node[left]{$y$};
\draw[gray, <->] (0,0,-0.5) node[left]{$-z$} -- (0,0,0.5) node[left]{$z$};

\draw (0.26,-0.26) circle (0.21);

\tdplotsetrotatedcoords{-45}{0}{0}
\begin{scope}[tdplot_rotated_coords]
\draw [fill] (0,0.015) -- (0.155,0.015) -- (0.155,-0.015) -- (0,-0.015) -- cycle;
\draw [fill] ({0.26*sqrt(2)},0) ellipse (.20 and .02);
\end{scope}

\end{tikzpicture}


\end{document}

tikz 2D rotieren für 3D Perspektive der Achsen

von godi » Mo 1. Okt 2018, 22:27

Hallo,
ich habe eine 2D-Zeichnung die ich gerne ein wenig rotieren würde, so dass eine 3D Perspektive zum einzeichnen der z-Achse möglich ist.

Dazu habe ich das tikz-3dplot Paket gefunden. Jedoch habe ich das Proplem, dass ich in meiner Zeichnung ein \pgftransformrotate ausführe und dann passen die Koordinaten nicht mehr.

Bsp:
\documentclass{article}

\usepackage{tikz}
\usepackage{tikz-3dplot}
        
\begin{document}

\begin{tikzpicture} [thick, scale=4]

% Coordinate system:
\draw[gray, <->] (-0.5,0) node[below]{$-x$} -- (0.5,0) node[below]{$x$};
\draw[gray, <->] (0,-0.5) node[left]{$-y$} -- (0, 0.5) node[left]{$y$};

\draw (0.26,-0.26) circle (0.21);

\pgftransformrotate{-45}
\draw [fill] (0,-0.015) rectangle (0.155, 0.015);
\draw [fill] ({0.26*sqrt(2)},0.0) ellipse (.20 and .02);

\end{tikzpicture}

\tdplotsetmaincoords{45}{15}

\begin{tikzpicture} [tdplot_main_coords, thick, scale=4]

% Coordinate system:
\draw[gray, <->] (-0.5,0,0) node[below]{$-x$} -- (0.5,0) node[below]{$x$};
\draw[gray, <->] (0,-0.5,0) node[left]{$-y$} -- (0,0.5,0) node[left]{$y$};
\draw[gray, <->] (0,0,-0.5) node[left]{$-z$} -- (0,0,0.5) node[left]{$z$};

\draw (0.26,-0.26) circle (0.21);

\pgftransformrotate{-45}
\draw [fill] (0,-0.015) rectangle (0.155, 0.015);
\draw [fill] ({0.26*sqrt(2)},0.0) ellipse (.20 and .02);

\end{tikzpicture}

\end{document}
Wie kann ich \pgftransformrotate umgehen bzw die richtige Rotation hinbekommen?

Nach oben