我正在尝试在曲线上绘制法线向量,并使用常用的“圆弧中的点”符号来表示。这是我目前所得到的,看起来不错,但需要手动调整角度和距离,我想知道是否可以自动放置它们。
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro\rightAngleRadius{0.2}
\coordinate (start) at (0,0);
\coordinate (end) at (2,0);
\draw (start) .. controls (0.6,0.7) and (1.3,0.2) .. (end)
node[sloped,inner sep=0cm,above,pos=.5,anchor=south west,
minimum height=12](N){};
\path (N.south west) edge[-stealth'] node[above left]
{$\vec{n}$} (N.north west);
\draw (N.south west) ++ (\rightAngleRadius,-1pt)
arc (-20:80:\rightAngleRadius);
\node[above right=-3pt] at (N.south west) {.};
\end{tikzpicture}
\end{document}
答案1
正如建议的那样这个答案,可以使用该markings
库来创建一个局部坐标系来绘制符号。
\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,positioning}
\begin{document}
\begin{tikzpicture}[
tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1
]
\coordinate (start) at (0, 0);
\coordinate (end) at (5,2);
\pgfmathsetmacro\rightAngleRadius{0.2}
\draw[tangent=0.4] (start)
to [out=20,in=120] (end);
\draw[->, use tangent] (0,0) -- ++ (0,1);
\draw[use tangent] (\rightAngleRadius,0) arc (0:90:\rightAngleRadius);
\draw[use tangent] (0.4*\rightAngleRadius,0.4*\rightAngleRadius) node{.};
\draw[use tangent,left] (0,1) node {$\vec{n}$};
\end{tikzpicture}
\end{document}