我想绘制一个 3D(旋转)笛卡尔坐标系,如附图所示。作为 TikZ 的新用户,我坚持以下几点:
1)如何绘制两个具有相同中心和不同半径的圆弧(箭头)
2)圆弧与直线的交点
3)该交点的旋转坐标(其中一种情况如图所示)
今天我借助示例和手册设法做了一些事情,但这肯定不是解决这个问题的有效且聪明的方法。
我将衷心感谢您的帮助。
\documentclass[tikz,border=12pt]{standalone}
\usetikzlibrary{intersections}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\tdplotsetmaincoords{60}{110}
\begin{document}
\begin{tikzpicture}
% add: rotation option
\coordinate (O) at (0,0,0);
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\draw[red] [name path=A1] (3,0) arc(0:120:3);
\draw[red][name path=r1] (0,0) -- (3,3);
\draw [name intersections={of=A1 and r1, by=y}] (y) circle (1pt);
\draw[blue] (6,0) arc(0:120:6);
\end{tikzpicture}
\end{document}
答案1
为了使用tikz-3dplot
,你需要安装它的坐标系。然后该3d
库允许你转换到各种平面。在这些平面上,你可以像往常一样绘制圆弧。
\documentclass[tikz,border=12pt]{standalone}
\usetikzlibrary{3d,calc}
\usepackage{tikz-3dplot}
\tdplotsetmaincoords{60}{-80}
\begin{document}
\begin{tikzpicture}[tdplot_main_coords,bullet/.style={fill,circle,inner sep=1.5pt,transform shape}]
\pgfmathsetmacro{\r}{3.5}
\pgfmathsetmacro{\R}{5}
\pgfmathsetmacro{\myangle}{60}
\coordinate (O) at (0,0,0);
% \draw[thick,-stealth] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
% \draw[thick,-stealth] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
% \draw[thick,-stealth] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\begin{scope}[canvas is xy plane at z=0]
\draw[blue,-latex] (120:\r) arc(120:-30:\r) node[above,black]{$s$};
\path (\myangle:\r) node[bullet] (P1){};
\draw[-stealth] ($(P1)+(\myangle+90:1)$) -- ($(P1)+(\myangle-90:2)$) node[above]{$\hat z$};
\draw[-stealth] (O) -- (0:\r) node[midway,right]{$\rho$};
\draw[-stealth] (O) -- (90:\r) node[midway,below]{$\rho$};
\draw[-stealth] (O) -- (\myangle:\R+1) node[below left]{$\hat x$};
\path (\myangle:\R) node[bullet](P2'){};
\end{scope}
\begin{scope}[canvas is xy plane at z=2]
\draw[red,-latex] (120:\R) arc(120:-30:\R) ;
\path (\myangle:\R)node[bullet] (P2){};
\draw[-stealth,thick] (P2) -- ++ (\myangle-90:0.5) node[midway,above]{$\mathrm{d}\vec r$};
\path (\myangle:\r) node[bullet](P1'){};
\draw[thin] (P2'.center) -- (P2.center) -- (P1'.center);
\end{scope}
\path (P1.center) -- (P1'.center) coordinate[pos=-0.3] (aux1)
coordinate[pos=1.5] (aux2);
\draw[-stealth] (aux1) -- (aux2) node[right]{$\hat y$};
\end{tikzpicture}
\end{document}