|
楼主 |
kuing
发表于 2014-3-10 14:38
[注]:此楼已多余,tikz/pgf 3.0 开始已有此功能
2、角弧标记- \newcommand\arcnode[6][0.2]{%
- \begin{scope}
- \clip (#2)--(#3)--(#4)--cycle;
- \draw (#3) circle (#5);
- \path let \p1=(#2),\p2=(#4),\p0=(#3) in
- ($(#3)+({0.5*atan2(\x1-\x0,\y1-\y0)+0.5*atan2(\x2-\x0,\y2-\y0)}:{#5+#1})$) node {$#6$}
- ($(#3)-({0.5*atan2(\x1-\x0,\y1-\y0)+0.5*atan2(\x2-\x0,\y2-\y0)}:{#5+#1})$) node {$#6$};
- \end{scope}}
复制代码 懒得写用法说明,因为还有待改进,至少有一个大bug,因为是用 \clip 弄的,所以那个角比较平的时候,弧以及字母可能会被切掉部分。
配合楼上的命令,用如下的代码- \begin{tikzpicture}
- \draw[->] (-3,0)--(3,0) node[above]{$x$};
- \draw[->] (0,-3)--(0,3) node[left]{$y$};
- \zba{45:-1}AA{-7};
- \zba{3,2.5}BB4;
- \zba{2,-1.1}CC{-3};
- \draw (A)--(B)--(C)--cycle;
- \arcnode BAC{0.3}\alpha
- \arcnode[0.25] ABC{0.35}\beta
- \arcnode BCA{0.2}\gamma
- \end{tikzpicture}
复制代码 即得
注:计算中用到了 atan2 函数,故需要 \usetikzlibrary{calc} |
|