使用 tikzpicture 在圆圈周围画出尖刺

使用 tikzpicture 在圆圈周围画出尖刺

最近,我与哥本哈根尼尔斯·玻尔研究所的一位讲师进行了邮件交流,讨论一张用 LaTeX 编写的两个惯性系的图片。他画了一张如下图所示的图: 在此处输入图片描述

他使用了 pstricks 包,并把代码发给了我。不过,我的 LaTeX 无法运行代码,所以我尝试使用 tikzpicture 制作图片。我重写了以下代码:

    \begin{figure}
\begin{center}
  \psset{unit=8.5mm}
  \begin{pspicture}(-3,-2.4)(14,3.5)
    \psset{linewidth=0.7pt}
    \psset{arrowsize=6pt}
%
    \rput(0,0){
      \psline[linewidth=1pt]{->}(0,0)(3.3,0)   \rput(3.3,-0.5){$x$}
      \psline[linewidth=1pt]{->}(0,0)(0,3.3)   \rput(-0.5,3.2){$y$}
      \psline[linewidth=1pt]{->}(0,0)(-2,-1.7) \rput(-2.1,-2.1){$z$}
       \rput[l](0.5,3.3){\textsf{S}}
    }
%
    \rput(7,0){
      \psline[linewidth=1pt]{->}(0,0)(3.3,0)   \rput(3.3,-0.5){$x^\prime$}
      \psline[linewidth=1pt]{->}(0,0)(0,3.3)   \rput(-0.5,3.2){$y^\prime$}
      \psline[linewidth=1pt]{->}(0,0)(-2,-1.7) \rput(-2.1,-2.1){$z^\prime$}
      \rput[l](0.5,3.3){\textsf{S}$^\prime$}
    }
%
    \psline{->}(5.5,2.2)(8.5,2.2) \rput(8.8,2.2){$v$}
    \rput(11,2.2){\scalebox{2}{\ding{90}}}
    \pscircle[linestyle=none,fillstyle=solid](11,2.2){0.2}
    \psdots[dotsize=4pt](11,2.2)
    \rput[c](11,3){\small \textsf{Begivenhed}}
    \rput[l](11.7,2.4){\small $(x,\,y,\,z,\,t)$}
    \rput[l](11.7,1.8){\small $(x^\prime,\,y^\prime,\,z^\prime,\,t^\prime)$}
    \psline{|->}(0.2,1.4)(6.8,1.4)     \rput(3.5,1.7){$vt$}
    \psline{|->}(7.2,1.4)(11,1.4)      \rput(9.1,1.7){$x^\prime$}
    \psline{|->}(0.2,0.8)(11,0.8)      \rput(5.6,1.1){$x$}
  \end{pspicture}
  \caption{En begivenhed betragtes fra to referencesystemer i
    standardkonfigurationen.}
  \label{fig:standardkonfig}
\end{center}
\end{figure}

转换为 tikz 中的以下转换代码:

\begin{center}

\begin{tikzpicture}

\coordinate[label= below left:$$] (origo) at (0,0);

\coordinate[label = below left:$$] (origos) at (7,0);

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};

\node[] at (0.5,3.3) {\textsf{S}};

\begin{scope}[xshift = 7cm]

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};

\node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};

\end{scope}

\draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};

\fill[black] (11,2.2) circle (4pt);

\node[] at (11,3) {\small \textsf{Begivenhed}};

\node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};

\node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};

\draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};

\end{tikzpicture}

\end{center}

结果是这样的: 在此处输入图片描述 几乎完全相同,除了 ps 代码上的圆圈看起来像太阳,但在我的代码 (tikz) 上只是一个点。你们有人知道如何创建这个小东西吗?

仅供参考,“Begivenhed” 是一个丹麦词,意思是事件,用于狭义相对论。那个小太阳应该是一个事件。

答案1

您可以使用极坐标来绘制线条。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,calc,arrows.meta}
\begin{document}
\begin{center}
  \begin{tikzpicture}
    \coordinate[label= below left:$$] (origo) at (0,0);
    \coordinate[label = below left:$$] (origos) at (7,0);
    \draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};
    \draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};
    \draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};
    \node[] at (0.5,3.3) {\textsf{S}};
    \begin{scope}[xshift = 7cm]
      \draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};
      \draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};
      \draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};
      \node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};
    \end{scope}
    \draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};
    \fill[black] (11,2.2) circle (4pt);
    \foreach \ang in {22.5,45,...,360}{%%%%%%%%%%%%%% Added
      \draw[ultra thick] (11,2.2) +(\ang:6pt) -- +(\ang:11pt);
    }
    \node[] at (11,3) {\small \textsf{Begivenhed}};
    \node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};
    \node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};
    \draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};
    \draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};
    \draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};
  \end{tikzpicture}
\end{center}
\end{document}

在此处输入图片描述

答案2

在原代码中,可以看到符号是由 生成的\ding{90}

由于两个代码示例中都缺少前言,所以人们只能猜测,但事实证明该命令来自以下pifont包:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\usepackage{pifont}

\begin{document}

\begin{center}

\begin{tikzpicture}

\coordinate[label= below left:$$] (origo) at (0,0);

\coordinate[label = below left:$$] (origos) at (7,0);

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};

\node[] at (0.5,3.3) {\textsf{S}};

\begin{scope}[xshift = 7cm]

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};

\node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};

\end{scope}

\draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};

%\fill[black] (11,2.2) circle (4pt);

\node[scale=3] at (11,2.2) {\ding{90}};

\node[] at (11,3) {\small \textsf{Begivenhed}};

\node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};

\node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};

\draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};

\end{tikzpicture}

\end{center}


\end{document}

在此处输入图片描述

答案3

这是由于尺寸太小而无法使用的decoration情况之一。ticks

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}

\coordinate[label= below left:${}$] (origo) at (0,0);

\coordinate[label = below left:${}$] (origos) at (7,0);

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (3.3,0) node[below]{$x$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (origo) -- (0,3.3) node[left]{$y$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (origo) -- (-2,-1.7) node[below]{$z$};

\node[] at (0.5,3.3) {\textsf{S}};

\begin{scope}[xshift = 7cm]

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (3.3,0) node[below]{$x'$};

\draw[line width = 1pt, -{Stealth[length=3mm]}] (0,0) -- (0,3.3) node[left]{$y'$};

\draw[line width= 1pt, -{Stealth[length=3mm]}] (0,0) -- (-2,-1.7) node[below]{$z'$};

\node[] at (0.5,3.3) {\textsf{S}$^{\prime}$};


\end{scope}

\draw[-{Stealth[length=3mm]}, line width=0.8pt](5.5,2.2) -- (8.5,2.2) node[right]{$v$};

\foreach \X in {0,30,...,330}
{\draw (11,2.2) -- ++ (\X:11pt);}
\fill[white] (11,2.2) circle (6pt);
\fill[black] (11,2.2) circle (4pt);


\node[] at (11,3) {\small \textsf{Begivenhed}};

\node[] at (12.3,2.4) {\small $(t, \, x, \, y, \, z)$};

\node[] at (12.5,1.8) {\small $(t', \, x', \, y', \, z')$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (0.2,1.4) -- (6.8,1.4) node[above] at (3.5,1.4) {$vt$};

\draw[|-{Stealth[length=3mm]}, line width=0.8pt] (7.2,1.4) -- (11,1.4) node[above] at (9.1,1.4) {$x^{\prime}$};

\draw[|-{Stealth[length=3mm]},line width=0.8pt] (0.2,0.8) -- (11,0.8) node[above] at (5.6,0.76) {$x$};

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案4

这不是一个完整的优秀答案。但也可以创建一个宏来TikZ使用此代码。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \def\Radius{4cm}
  \draw[line width=1.2mm]
    \foreach \a in {0,10,20, 30, ..., 350} {
      (0, 0) -- (\a:\Radius)
    }
    (0, 0) -- (10:3cm)
  ;
  \end{tikzpicture}
\end{document}

相关内容