如何让箭头在 tikz 中以 3D 形式漂浮?

如何让箭头在 tikz 中以 3D 形式漂浮?

我正在 tikz 中绘制一个狄拉克锥,我希望能够用箭头指示自旋,如下图所示,我刚刚在 Adob​​e Reader 中手动添加了箭头:

在此处输入图片描述

我该如何添加这些?

这是我的狄拉克锥代码:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\def\h{4.6}
\def\a{2}
\def\b{0.5}
\definecolor{side}{RGB}{65,134,198}
\definecolor{middle}{RGB}{126,169,208}
\definecolor{top}{RGB}{35,104,168}
\definecolor{darkerred}{RGB}{223,51,59}
\definecolor{lighterred}{RGB}{236,123,127}

\def\shadebody{\fill[
    left color=top,
    right color=top,
    middle color=side,
    shading=axis,
    opacity=1
    ] }
\def\shadetop{\fill[
    left color=darkerred,
    right color=darkerred,
    middle color=lighterred,
    shading=axis,
    opacity=1
    ] }


\shadebody
  (\a,0) -- (0,\h) -- (-\a,0) arc (180:360:\a cm and \b cm);
\draw[line width = 0.5pt] 
  (-\a,0) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

  %upper part
\shadetop
(0,2*\h) circle (\a cm and \b cm);

\shadebody
(\a,2*\h) -- (0,\h) -- (-\a,2*\h) arc (180:360:\a cm and \b cm);

% draw circumfering line
\draw[line width = 0.5pt] (-\a,2*\h) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

%\draw[line width = 0.5pt] (\a,2*\h) arc (0:180:\a cm and \b cm);

% circle on top  
\draw[line width = 1.5pt, color=red] (0, 2*\h) circle (\a cm and \b cm);

% Dirac point  
\fill[black] (0,\h) circle (5pt);

\end{tikzpicture}

\end{document}

答案1

这样可以吗?

在此处输入图片描述

这是由

\draw[line width = 1.5pt, color=red,-latex] (0, 2*\h-\bb) arc[start angle=-90,end angle= 50, x radius =\aa cm , y radius =\bb cm];

\draw[line width = 1.5pt, color=red,-latex] (0, 2*\h+\bb) arc[start angle=-270,end angle= -120, x radius =\aa cm , y radius =\bb cm];

完整代码:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\def\h{4.6}
\def\a{2}
\def\b{0.5}
\def\aa{2.3}            %%<<<--- added
\def\bb{0.75}           %%<<<--- added
\definecolor{side}{RGB}{65,134,198}
\definecolor{middle}{RGB}{126,169,208}
\definecolor{top}{RGB}{35,104,168}
\definecolor{darkerred}{RGB}{223,51,59}
\definecolor{lighterred}{RGB}{236,123,127}

\def\shadebody{\fill[
    left color=top,
    right color=top,
    middle color=side,
    shading=axis,
    opacity=1
    ] }
\def\shadetop{\fill[
    left color=darkerred,
    right color=darkerred,
    middle color=lighterred,
    shading=axis,
    opacity=1
    ] }


\shadebody
  (\a,0) -- (0,\h) -- (-\a,0) arc (180:360:\a cm and \b cm);
\draw[line width = 0.5pt]
  (-\a,0) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

  %upper part
\shadetop
(0,2*\h) circle (\a cm and \b cm);

\shadebody
(\a,2*\h) -- (0,\h) -- (-\a,2*\h) arc (180:360:\a cm and \b cm);

% draw circumfering line
\draw[line width = 0.5pt] (-\a,2*\h) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

%\draw[line width = 0.5pt] (\a,2*\h) arc (0:180:\a cm and \b cm);

% circle on top
\draw[line width = 1.5pt, color=red] (0, 2*\h) circle (\a cm and \b cm);

\draw[line width = 1.5pt, color=red,-latex] (0, 2*\h-\bb) arc[start angle=-90,end angle= 50, x radius =\aa cm , y radius =\bb cm];

\draw[line width = 1.5pt, color=red,-latex] (0, 2*\h+\bb) arc[start angle=-270,end angle= -120, x radius =\aa cm , y radius =\bb cm];

% Dirac point
\fill[black] (0,\h) circle (5pt);

\end{tikzpicture}

\end{document}

装有四支箭和bending更好的箭头库:

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{bending}

\begin{document}
\begin{tikzpicture}
\def\h{4.6}
\def\a{2}
\def\b{0.5}
\def\aa{2.3}
\def\bb{0.75}
\definecolor{side}{RGB}{65,134,198}
\definecolor{middle}{RGB}{126,169,208}
\definecolor{top}{RGB}{35,104,168}
\definecolor{darkerred}{RGB}{223,51,59}
\definecolor{lighterred}{RGB}{236,123,127}

\def\shadebody{\fill[
    left color=top,
    right color=top,
    middle color=side,
    shading=axis,
    opacity=1
    ] }
\def\shadetop{\fill[
    left color=darkerred,
    right color=darkerred,
    middle color=lighterred,
    shading=axis,
    opacity=1
    ] }


\shadebody
  (\a,0) -- (0,\h) -- (-\a,0) arc (180:360:\a cm and \b cm);
\draw[line width = 0.5pt]
  (-\a,0) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

  %upper part
\shadetop
(0,2*\h) circle (\a cm and \b cm);

\shadebody
(\a,2*\h) -- (0,\h) -- (-\a,2*\h) arc (180:360:\a cm and \b cm);

% draw circumfering line
\draw[line width = 0.5pt] (-\a,2*\h) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

%\draw[line width = 0.5pt] (\a,2*\h) arc (0:180:\a cm and \b cm);

% circle on top
\draw[line width = 1.5pt, color=red] (0, 2*\h) circle (\a cm and \b cm);

\draw[line width = 1.5pt, color=red,-latex] (0, 2*\h-\bb) arc[start angle=-90,end angle= -30, x radius =\aa cm , y radius =\bb cm];

\draw[line width = 1.5pt, color=red,-latex] (0, 2*\h+\bb) arc[start angle=-270,end angle= -210, x radius =\aa cm , y radius =\bb cm];

\draw[line width = 1.5pt, color=red,-latex] (\aa, 2*\h) arc[start angle=0,end angle= 70, x radius =\aa cm , y radius =\bb cm];

\draw[line width = 1.5pt, color=red,-latex] (-\aa, 2*\h) arc[start angle=-180,end angle= -100, x radius =\aa cm , y radius =\bb cm];

% Dirac point
\fill[black] (0,\h) circle (5pt);

\end{tikzpicture}

\end{document}

在此处输入图片描述

带有直箭头:

\documentclass{article}
\usepackage{tikz}

\usetikzlibrary{bending}

\begin{document}
\begin{tikzpicture}
\def\h{4.6}
\def\a{2}
\def\b{0.5}
\def\aa{2.3}
\def\bb{0.75}
\definecolor{side}{RGB}{65,134,198}
\definecolor{middle}{RGB}{126,169,208}
\definecolor{top}{RGB}{35,104,168}
\definecolor{darkerred}{RGB}{223,51,59}
\definecolor{lighterred}{RGB}{236,123,127}

\def\shadebody{\fill[
    left color=top,
    right color=top,
    middle color=side,
    shading=axis,
    opacity=1
    ] }
\def\shadetop{\fill[
    left color=darkerred,
    right color=darkerred,
    middle color=lighterred,
    shading=axis,
    opacity=1
    ] }


\shadebody
  (\a,0) -- (0,\h) -- (-\a,0) arc (180:360:\a cm and \b cm);
\draw[line width = 0.5pt]
  (-\a,0) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

  %upper part
\shadetop
(0,2*\h) circle (\a cm and \b cm);

\shadebody
(\a,2*\h) -- (0,\h) -- (-\a,2*\h) arc (180:360:\a cm and \b cm);

% draw circumfering line
\draw[line width = 0.5pt] (-\a,2*\h) arc (180:360:\a cm and \b cm) -- (0,\h) -- cycle;

%\draw[line width = 0.5pt] (\a,2*\h) arc (0:180:\a cm and \b cm);

% circle on top
\draw[line width = 1.5pt, color=red] (0, 2*\h) circle (\a cm and \b cm);

\draw[line width = 1.5pt, color=red,-latex] ([shift={(8pt,-3pt)}]0, 2*\h-\bb) -- +(10:1.5cm);

\draw[line width = 1.5pt, color=red,-latex] ([shift={(-12pt,3pt)}]0, 2*\h+\bb) -- +(190:1.5cm);

\draw[line width = 1.5pt, color=red,-latex] ([shift={(-8pt,13pt)}]\aa, 2*\h) -- +(165:1.5cm);

\draw[line width = 1.5pt, color=red,-latex] ([shift={(8pt,-13pt)}]-\aa, 2*\h) -- +(-15:1.5cm);

% Dirac point
\fill[black] (0,\h) circle (5pt);

\end{tikzpicture}

\end{document}

在此处输入图片描述

根据需要调整初始点和角度。

相关内容