如果这个问题在其他地方有答案,我深感抱歉;我看了很多问题,但找不到解决方案。
以下是我看过的一些帖子(也许他们确实回答了这个问题,只是我还不够聪明看不到 - 这总是有可能的):
我甚至查看了rotate=
本文中描述的选项,但无济于事:https://latexdraw.com/rotate-a-path-around-a-point-double-pendulum-case/
我的问题是:如何旋转 Ti钾3D 中的 Z 路径?如果这是不可能的,那么如何填充 3D 球体以实现相同的效果?如果这两个想法都无法实现,那么我该怎么做?例如,我是否需要“用大锤砸坚果”并使用 Ti钾Z-3Dplot?我愿意尽一切努力。提前感谢您的帮助。
如您所见,椭圆与 xy 平面平行。我的目标是旋转这个椭圆(或者如果可能的话,将其绘制为球体),以便它在观察者看来是一个圆形。
梅威瑟:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{perspective}
\begin{document}
\begin{tikzpicture}[3d view={125}{30}, scale=4]
\draw[thick, -latex] (0,0,0) -- (2,0,0) node[pos=1,above left]{$x$};
\draw[thick, -latex] (0,0,0) -- (0,2,0) node[pos=1,below left]{$y$};
\draw[thick, -latex] (0,0,0) -- (0,0,2) node[pos=1,left]{$z$};
\node[above left] at (0,0,0) {$O$};
\draw[red,thick] (0,0,0) -- node[pos=0.5,above left] {\color{black}$a$} (0.65,0,0) -- node[pos=0.5,below left] {\color{black}$b$} (0.65,0.75,0) -- node[pos=0.5,right] {\color{black}$c$} (0.65,0.75,1.2);
\fill[red] (0.65,0.75,1.2) circle [radius=0.5];
\foreach \x in {0,0.05,...,2}{
\draw[thin] (\x,0,1.2) -- (\x,2,1.2);
\draw[thin] (0,\x,1.2) -- (2,\x,1.2);}
%\fill[red,3d view={0}{0}] (0.65,0.75,1.2) circle [radius=0.03]; % I would like to do something like this
\end{tikzpicture}
\end{document}
谢谢!
答案1
这可能是您的问题的一个(简化的)答案:
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{perspective}
\begin{document}
\begin{tikzpicture}[3d view={125}{30}, scale=2]
\draw[thick, -latex] (0,0,0) -- (4,0,0) node[pos=1,above left]{$x$};
\draw[thick, -latex] (0,0,0) -- (0,4,0) node[pos=1,below left]{$y$};
\draw[thick, -latex] (0,0,0) -- (0,0,4) node[pos=1,left]{$z$};
\node[above left] at (0,0,0) {$O$};
% \draw[red,thick] (0,0,0) -- node[pos=0.5,above left] {\color{black}$a$} (0.65,0,0) -- node[pos=0.5,below left] {\color{black}$b$} (0.65,0.75,0) -- node[pos=0.5,right] {\color{black}$c$} (0.65,0.75,1.2);
\draw[blue] (0,0,0) circle [radius=2];
\foreach \r in {-2,-1.9,...,2}{
\pgfmathsetmacro{\raggio}{sqrt(4-\r*\r)}
\fill[red,opacity=.1] (0,0,\r) circle [radius=\raggio];
}
% \foreach \x in {0,0.05,...,2}{
% \draw[thin] (\x,0,1.2) -- (\x,2,1.2);
% \draw[thin] (0,\x,1.2) -- (2,\x,1.2);}
%\fill[red,3d view={0}{0}] (0.65,0.75,1.2) circle [radius=0.03]; % I would like to do something like this
\end{tikzpicture}
\end{document}
答案2
这是我使用 spath3 和 tikz-3dplot 得出的答案。本质上,我围绕原点制作形状,然后将其平移到我想要的位置。这个问题让我想起了你们不久前帮助我解决的一个问题,我能够将那个问题的解决方案映射到这个问题上。这是我用作灵感的帖子:如何旋转使用 TikZ 中的 [use path=\name] 选项创建的路径?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{perspective,spath3}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{60}{135}
\begin{tikzpicture}[tdplot_main_coords, scale=4]
\draw[thick, -latex] (0,0,0) -- (2,0,0) node[pos=1,above left]{$x$};
\draw[thick, -latex] (0,0,0) -- (0,2,0) node[pos=1,below left]{$y$};
\draw[thick, -latex] (0,0,0) -- (0,0,2) node[pos=1,left]{$z$};
\node[above left] at (0,0,0) {$O$};
\draw[red,thick] (0,0,0) -- node[pos=0.5,above left] {\color{black}$a$} (0.65,0,0) -- node[pos=0.5,below left] {\color{black}$b$} (0.65,0.75,0) -- node[pos=0.5,right] {\color{black}$c$} (0.65,0.75,1.2);
\tdplotsetrotatedcoords{60}{60}{0}
\path[tdplot_rotated_coords,spath/save=name] (0,0,0) circle [radius=0.1];
\path[fill,red,spath/use={name, transform={shift={(4*0.65,4*0.75,4*1.2)}}}];
\end{tikzpicture}
\end{document}