|
kuing
发表于 2019-3-20 17:04
继续,来试一下仿照 11# 的方法做一个弧标记:- \newlength\hur%弧半径
- \newlength\huj%字母与弧的间距
- \hur=7pt
- \huj=5pt
- \newcommand\hubj[5][]{%
- \draw[#1] let \p1=(#2),\p2=(#4),\p0=(#3),
- \n1={atan2(\y1-\y0,\x1-\x0)},
- \n2={atan2(\y2-\y0,\x2-\x0)},
- \n3={Mod(\n2-\n1,360)} in
- (#3)++(\n1:\hur)arc[start angle=\n1,delta angle=\n3,radius=\hur]
- (#3)+(\n1+0.5*\n3:\hur+\huj) node {$#5$};
- }
复制代码 用的时候要注意点的顺序,我的设计是让它总是逆时针。
举个栗子:- \tikz{
- \coordinate[label=right:$A$] (A) at (2,0);
- \coordinate[label=below left:$B$] (B) at (1.75,1.75);
- \coordinate[label=left:$C$] (C) at (0,1.5);
- \draw (A)--(B)--(C)--cycle;
- \hubj ACBx
- \hubj BACy
- \hubj[red,thick]ABCz
- }
复制代码 效果是:
特别需要指出的是 \n3={Mod(\n2-\n1,360)} 这一句,为什么要 mod 360?不 mod 会出啥问题?大家不妨想想。 |
|