有没有简单的方法可以在曲线之间插入节点,如图所示?使用node[midway] {$\alpha$}
只会将文本放在曲线旁边。
另外,是否可以确保这些线彼此保持平行?
编辑:我使用的代码是:
\def\centerarc[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (initial angle:final angle:radius)
{ \draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }
\begin{tikzpicture}[scale=5]
\coordinate (A) at (0, 0);
\coordinate (B) at (0, .7);
\coordinate (C) at (2, 0);
\coordinate (D) at ($0.75*(B)+0.25*(C)$);
\coordinate (E) at ($0.6*(A)+.4*(B)$);
\scope[rotate=-19, shift=(D)]\input{figures/clarky}\endscope
\draw[thick] (B) -- (C);
\draw[thick] (A) -- (C);
\draw[dashed] (E) -- (C);
\centerarc[thick, <->, ](C)(179.5:161:2) node[loc=.5, fill=white] {$\alpha$};
\centerarc[thick, <->, ](C)(179.5:172.5:1.8);
\centerarc[thick, <->, ](C)(171.5:161:1.8);
\begin{scope}[shift={(-.5, 0)}, scale=.17]
\draw[->] (0, 0) -- (1, 0) node[anchor=west] {x};
\draw[->] (0, 0) -- (0, 1) node[anchor=west] {z};
\end{scope}
\end{tikzpicture}
这样,弧线就如建议的那样平行了,但是,我没有找到一种很好的方法来使用坐标。使用node[midway, fill=white] {$\alpha$}
将节点放在弧的底部。
答案1
不幸的是,您的代码片段不可编译(文件clarky
未知),因此下面的 MWE 仅包含绘制角度的部分。为此使用了 TikZ 库angles
和quotes
(有关详细信息,请参阅 TikZ 和 PGF 手册,第节41 角度库,第 570-571 页和第18.2.1 引号语法,第267--268页)):
\documentclass[tikz, margin=3.141592]{standalone}
\usetikzlibrary{angles,
calc,
quotes}
\usepackage{amsmath}
\begin{document}
\def\centerarc[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (initial angle:final angle:radius)
{ \draw[#1] ($(#2)+({#5*cos(#3)},{#5*sin(#3)})$) arc (#3:#4:#5); }
\begin{tikzpicture}[scale=5,
my angle/.style = {draw, <->,
angle radius = #1,
angle eccentricity=1,
anchor=center,
},
every pic quotes/.style = {inner sep=1pt, fill=white}
]
\coordinate (A) at (0, 0);
\coordinate (B) at (0, .7);
\coordinate (C) at (2, 0);
\coordinate (E) at ($0.6*(A)+.4*(B)$);
%
\draw[thick] (A) -- (C) -- (B);
\draw[dashed] (E) -- (C);
\pic [my angle=88mm, "$\alpha$"] {angle = B--C--A};
\pic [my angle=77mm, "$\alpha_{\text{eff}}$"] {angle = E--C--A};
\pic [my angle=77mm, "$\alpha_i$"] {angle = B--C--E};
\end{tikzpicture}
\end{document}