Tikz 旋转序列

Tikz 旋转序列

我对 Latex 还不太熟悉。我想创建一个图形来表示不同晶体取向的晶胞滑移系统。我正在使用 TikZ,能够创建 100 和 110 取向的图形。但是,我很难创建 111 晶体取向的图形,因为需要绕两个轴旋转,即绕 z 轴旋转 45 度,绕 x 轴旋转 54.74 度。第一次旋转效果很好,但第二次旋转使用的是已经旋转的 x 轴而不是原始的 x 轴。有什么技巧可以实现这一点吗?

这是我的代码,作为四个滑移系统之一的示例,该系统具有 100 个晶体取向,需要旋转(这里不应用旋转):

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta,3d}
\begin{document}
\begin{figure}[h!]
    \centering
\tdplotsetmaincoords{60}{60} 
\begin{tikzpicture}[scale=1,tdplot_main_coords]
\draw[-latex, blue] (0,0,0) -- (5,0,0) node[anchor=north east]{$x$};
\draw[-latex, blue] (0,0,0) -- (0,5,0) node[anchor=north west]{$y$};
\draw[-latex, blue] (0,0,0) -- (0,0,5) node[anchor=south]{$z$};
\def\size{2}
\begin{scope}     
        \coordinate (A0) at (0,0,0);
        \coordinate (A1) at (0,0,\size);
        \coordinate (A2) at (0,\size,0);
        \coordinate (A3) at (0,\size,\size);
        \coordinate (A4) at (\size,0,0);
        \coordinate (A5) at (\size,0,\size);
        \coordinate (A6) at (\size,\size,0);
        \coordinate (A7) at (\size,\size,\size);
        \draw[black,dashed] (A0) -- (A1);
        \draw[black,dashed] (A0) -- (A2);
        \draw[black,dashed] (A0) -- (A4);
        \fill[red, opacity=0.3] (A0) -- (A3) -- (A6) -- cycle;
        \draw[-{Stealth[length=4mm]}, thick, red] (A0) -- (A3);
        \draw[-{Stealth[length=4mm]}, thick, red] (A0) -- (A6);
        \draw[-{Stealth[length=4mm]}, thick, red] (A6) -- (A3);
        
        \draw[black] (A2) -- (A3);
        \draw[black] (A2) -- (A6);
        \draw[black] (A3) -- (A1);
        \draw[black] (A3) -- (A7);
        \draw[black] (A4) -- (A6);
        \draw[black] (A4) -- (A5);
        \draw[black] (A5) -- (A1);
        \draw[black] (A5) -- (A7);
        \draw[black] (A6) -- (A7);
    \end{scope}
\end{tikzpicture}
\caption{Slip systems for a $\langle 100\rangle$ orientation.}
    \label{fig:enter-label}
\end{figure}
\end{document}

制作此图:

在此处输入图片描述

这是我尝试表示 111 晶体取向:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta,3d}
\begin{document}
\begin{figure}[h!]
    \centering
\tdplotsetmaincoords{60}{60} 
\begin{tikzpicture}[scale=1,tdplot_main_coords]
\draw[-latex, blue] (0,0,0) -- (5,0,0) node[anchor=north east]{$x$};
\draw[-latex, blue] (0,0,0) -- (0,5,0) node[anchor=north west]{$y$};
\draw[-latex, blue] (0,0,0) -- (0,0,5) node[anchor=south]{$z$};
\def\size{2}
\begin{scope}[rotate around z = 45, rotate around y = 54.74]     
        \coordinate (A0) at (0,0,0);
        \coordinate (A1) at (0,0,\size);
        \coordinate (A2) at (0,\size,0);
        \coordinate (A3) at (0,\size,\size);
        \coordinate (A4) at (\size,0,0);
        \coordinate (A5) at (\size,0,\size);
        \coordinate (A6) at (\size,\size,0);
        \coordinate (A7) at (\size,\size,\size);
        \draw[black,dashed] (A0) -- (A1);
        \draw[black,dashed] (A0) -- (A2);
        \draw[black,dashed] (A0) -- (A4);
        \fill[red, opacity=0.3] (A0) -- (A3) -- (A6) -- cycle;
        \draw[-{Stealth[length=4mm]}, thick, red] (A0) -- (A3);
        \draw[-{Stealth[length=4mm]}, thick, red] (A0) -- (A6);
        \draw[-{Stealth[length=4mm]}, thick, red] (A6) -- (A3);
        
        \draw[black] (A2) -- (A3);
        \draw[black] (A2) -- (A6);
        \draw[black] (A3) -- (A1);
        \draw[black] (A3) -- (A7);
        \draw[black] (A4) -- (A6);
        \draw[black] (A4) -- (A5);
        \draw[black] (A5) -- (A1);
        \draw[black] (A5) -- (A7);
        \draw[black] (A6) -- (A7);
    \end{scope}
\end{tikzpicture}
\caption{Slip systems for a $\langle 100\rangle$ orientation.}
    \label{fig:enter-label}
\end{figure}
\end{document}

制作此图:

在此处输入图片描述

有什么方法可以在 TikZ 中实现此功能吗?另外,如果对此感兴趣的话,我正在使用 Overleaf 进行写作。

我感谢任何帮助我完成这项工作的人,因为我已经花了相当多的时间,但仍然无法使它发挥作用......

编辑:此图像与我想要实现的图像类似,但参考样品表面位于左侧(或右侧),因此我的图像的 z 轴在此处为水平方向。因此,对于 <111> 方向,{111} 平面(我的图像中的红色三角形)与样品表面平行(或与 xyz 系统的 xy 平面平行) 在此处输入图片描述

答案1

在此处输入图片描述

如果我正确理解了您想要获得的内容,我的第一印象是旋转顺序存在问题。您编写代码的方式是先围绕 x 旋转,然后围绕 z 旋转。(顺便说一句,如果您将 x 写成了 y,那就是错误。)在问题(您的文本)中,您先谈论的是 z,然后谈论的是 x。

您可以在图中看到两个结果。

一些评论

  • 由于立方体会根据视点而变化,因此虚线边缘具有误导性。
  • 我使用不同的观点来更好地掌握组合旋转的结果。
  • 您命名顶点的方式很奇怪!
  • 下面的代码比较长,因为有三个绘图。但是它几乎就是将立方体设置成元素的代码pic

代码

\documentclass{article}
\usepackage[top=100pt, bottom=75pt, left=75pt, right=75pt]{geometry}
\setlength{\headsep}{15pt}
\setlength{\footskip}{45pt}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta,3d}
\usetikzlibrary{math}
\begin{document}

\tikzset{%
  vertex/.style={scale=.6, fill=orange, fill opacity=.2,
    text=blue, text opacity=1},
  pics/crystal x and z/.style 2 args={%
    code={%
      \begin{scope}[rotate around z=#2, rotate around x=#1]     
        \path (0,0,0) coordinate (A0) node[vertex] {$0$};
        \path (0,0,\size) coordinate (A1) node[vertex] {$1$};
        \path (0,\size,0) coordinate (A2) node[vertex] {$2$};
        \path (0,\size,\size) coordinate (A3) node[vertex] {$3$};
        \path (\size,0,0) coordinate (A4) node[vertex] {$4$};
        \path (\size,0,\size) coordinate (A5) node[vertex] {$5$};
        \path (\size,\size,0) coordinate (A6) node[vertex] {$6$};
        \path (\size,\size,\size) coordinate (A7) node[vertex] {$7$};
        \fill[red, opacity=0.3] (A0) -- (A3) -- (A6) -- cycle;
        \draw[-{Stealth[length=1ex]}, red] (A0) -- (A3);
        \draw[-{Stealth[length=1ex]}, red] (A0) -- (A6);
        \draw[-{Stealth[length=1ex]}, thick, green!50!black] (A6) -- (A3);
        
        \draw[black] (A0) -- (A1);
        \draw[black] (A0) -- (A2);
        \draw[black] (A0) -- (A4);
        \draw[black] (A2) -- (A3);
        \draw[black] (A2) -- (A6);
        \draw[black] (A3) -- (A1);
        \draw[black] (A3) -- (A7);
        \draw[black] (A4) -- (A6);
        \draw[black] (A4) -- (A5);
        \draw[black] (A5) -- (A1);
        \draw[black] (A5) -- (A7);
        \draw[black] (A6) -- (A7);
      \end{scope}
    }
  },
  pics/crystal z and x/.style 2 args={%
    code={%
      \begin{scope}[rotate around x=#2, rotate around z=#1]     
        \path (0,0,0) coordinate (A0) node[vertex] {$0$};
        \path (0,0,\size) coordinate (A1) node[vertex] {$1$};
        \path (0,\size,0) coordinate (A2) node[vertex] {$2$};
        \path (0,\size,\size) coordinate (A3) node[vertex] {$3$};
        \path (\size,0,0) coordinate (A4) node[vertex] {$4$};
        \path (\size,0,\size) coordinate (A5) node[vertex] {$5$};
        \path (\size,\size,0) coordinate (A6) node[vertex] {$6$};
        \path (\size,\size,\size) coordinate (A7) node[vertex] {$7$};
        \fill[red, opacity=0.3] (A0) -- (A3) -- (A6) -- cycle;
        \draw[-{Stealth[length=1ex]}, red] (A0) -- (A3);
        \draw[-{Stealth[length=1ex]}, red] (A0) -- (A6);
        \draw[-{Stealth[length=1ex]}, thick, green!50!black] (A6) -- (A3);
        
        \draw[black] (A0) -- (A1);
        \draw[black] (A0) -- (A2);
        \draw[black] (A0) -- (A4);
        \draw[black] (A2) -- (A3);
        \draw[black] (A2) -- (A6);
        \draw[black] (A3) -- (A1);
        \draw[black] (A3) -- (A7);
        \draw[black] (A4) -- (A6);
        \draw[black] (A4) -- (A5);
        \draw[black] (A5) -- (A1);
        \draw[black] (A5) -- (A7);
        \draw[black] (A6) -- (A7);
      \end{scope}
    }
  }
}
\begin{figure}[h!]
  \centering
  \tdplotsetmaincoords{75}{165} 
  \begin{tikzpicture}[scale=.7, tdplot_main_coords,
    evaluate={\size = 2; \a = 3.5;}]
    \draw[-latex, blue] (0,0,0) -- (\a,0,0) node[anchor=north east]{$x$};
    \draw[-latex, blue] (0,0,0) -- (0,\a,0) node[anchor=north west]{$y$};
    \draw[-latex, blue] (0,0,0) -- (0,0,\a) node[anchor=south]{$z$};
    \path (0, 0) pic {crystal x and z={0}{0}};    
  \end{tikzpicture}
  \qquad
  \begin{tikzpicture}[scale=.7, tdplot_main_coords,
    evaluate={\size = 2; \a = 3.5;}]
    \draw[-latex, blue] (0,0,0) -- (\a,0,0) node[anchor=north east]{$x$};
    \draw[-latex, blue] (0,0,0) -- (0,\a,0) node[anchor=north west]{$y$};
    \draw[-latex, blue] (0,0,0) -- (0,0,\a) node[anchor=south]{$z$};
    \path (0, 0) pic {crystal x and z={54.74}{0}};    
  \end{tikzpicture}
  \qquad
  \begin{tikzpicture}[scale=.7, tdplot_main_coords,
    evaluate={\size = 2; \a = 3.5;}]
    \draw[-latex, blue] (0,0,0) -- (\a,0,0) node[anchor=north east]{$x$};
    \draw[-latex, blue] (0,0,0) -- (0,\a,0) node[anchor=north west]{$y$};
    \draw[-latex, blue] (0,0,0) -- (0,0,\a) node[anchor=south]{$z$};
    \path (0, 0) pic {crystal x and z={54.74}{45}};
  \end{tikzpicture}
  \caption{Rotations around $Ox$ first and $Oz$ second}
  \label{fig:enter-label}
\end{figure}


\begin{figure}[h!]
  \centering
  \tdplotsetmaincoords{75}{165} 
  \begin{tikzpicture}[scale=.7, tdplot_main_coords,
    evaluate={\size = 2; \a = 3.5;}]
    \draw[-latex, blue] (0,0,0) -- (\a,0,0) node[anchor=north east]{$x$};
    \draw[-latex, blue] (0,0,0) -- (0,\a,0) node[anchor=north west]{$y$};
    \draw[-latex, blue] (0,0,0) -- (0,0,\a) node[anchor=south]{$z$};
    \path (0, 0) pic {crystal z and x={0}{0}};    
  \end{tikzpicture}
  \qquad
  \begin{tikzpicture}[scale=.7, tdplot_main_coords,
    evaluate={\size = 2; \a = 3.5;}]
    \draw[-latex, blue] (0,0,0) -- (\a,0,0) node[anchor=north east]{$x$};
    \draw[-latex, blue] (0,0,0) -- (0,\a,0) node[anchor=north west]{$y$};
    \draw[-latex, blue] (0,0,0) -- (0,0,\a) node[anchor=south]{$z$};
    \path (0, 0) pic {crystal z and x={45}{0}};    
  \end{tikzpicture}
  \qquad
  \begin{tikzpicture}[scale=.7, tdplot_main_coords,
    evaluate={\size = 2; \a = 3.5;}]
    \draw[-latex, blue] (0,0,0) -- (\a,0,0) node[anchor=north east]{$x$};
    \draw[-latex, blue] (0,0,0) -- (0,\a,0) node[anchor=north west]{$y$};
    \draw[-latex, blue] (0,0,0) -- (0,0,\a) node[anchor=south]{$z$};
    \path (0, 0) pic {crystal z and x={45}{54.74}};
  \end{tikzpicture}
  \caption{Rotations around $Oz$ first and $Ox$ second}
  \label{fig:enter-label}
\end{figure}
\end{document}

相关内容