如何将 tikz 图片文本放置在角度内?

如何将 tikz 图片文本放置在角度内?

我想将文本“0.78”定位在我的角度内,而不是在其外围。另外,我想看到被黄色填充覆盖的线。这是我目前的代码,我哪里出错了?谢谢你的帮助

 % ray on rim edge
\coordinate (A) at (7,7);
\coordinate (B) at (7,3.45254);

    % incident ray
    \draw[black!60!white,line width=0.25,directed] (A) -- (B);

    % ray - no errors
    \coordinate (C) at (0.09523861, 3.54684049);
    \draw[black!60!white,line width=0.25,tube] (B) -- (C);

    %ray - positive half-acceptance
    \draw[line width=0.25, far, black!60!white, domain=7:0.00493732] plot(\x,{-0.02722281*(\x)+3.6434});

    %ray - negative half-acceptance
    \coordinate (D) at (0.00493732, 3.45283808);
    \draw[black!60!white,line width=0.25,far] (B) -- (D);     

\coordinate(X) at (0.00493732,3.6434);

\path (X)--(B)--(D) pic[draw=orange, <->, ,angle eccentricity=1.05, angle radius=6cm, font=\tiny, fill=yellow!20!white, pic text = 0.78$^{\circ}$]{angle = X--B--D};

答案1

您必须按正确的顺序绘制对象。要将标签放在角度的右侧,需要一些技巧,因为标签默认放在左侧。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{angles}
\begin{document}
\begin{tikzpicture}[
  directed/.style={},
  tube/.style={},
  far/.style={},
  ]
  % ray on rim edge
  \coordinate (A) at (7,7);
  \coordinate (B) at (7,3.45254);
  \coordinate (C) at (0.09523861, 3.54684049);
  \coordinate (D) at (0.00493732, 3.45283808);
  \coordinate (X) at (0.00493732,3.6434);

  % incident ray
  \draw[black!60!white,line width=0.25,directed] (A) -- (B);

  % ray - no errors
  \draw[black!60!white,line width=0.25,tube] (B) -- (C);

  \path (X)--(B)--(D) pic[draw=orange, <->, ,angle eccentricity=1.05, angle radius=6cm, font=\tiny, fill=yellow!20!white, pic text = $0.78^{\circ}$, pic text options={right=.3cm}]{angle = X--B--D};

  % ray - positive half-acceptance
  \draw[line width=0.25, far, black!60!white, domain=7:0.00493732] plot(\x,{-0.02722281*(\x)+3.6434});

  % ray - negative half-acceptance
  \draw[black!60!white,line width=0.25,far] (B) -- (D);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容