我绘制了一条贝塞尔曲线,并在 0.2、0.4 等位置获取了点。我想从其中一个点绘制一个矢量。但矢量并非源自该点。点和矢量之间有一些间隙。我该如何修复它?
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes.geometric}
\begin{document}
\begin{tikzpicture}
\draw[very thin,black!50, step=0.5] (-1,-1) grid (6,6);
\draw[->,>=stealth',very thick] (-1,0)--(6,0);
\draw[->,>=stealth',very thick] (0,-1)--(0,6);
\draw (0,0) .. controls (1,1) and (-5,1) .. (6,6)
\foreach \p/\l in {0.2/A,0.4/B,0.6/C,0.8/D} {node[pos=\p,label=$\l$,anchor=base](\l) {}};
\foreach \l in {A,B,C,D} {\draw[fill] (\l) circle (2pt);}
\draw[red, thick, ->, >=stealth'] (C) -- +(2,1) node[right] {$\vec F_C$};
\end{tikzpicture}
\end{document}
答案1
您可以将第一个箭头的锚点定义为C.center
。是这个意思吗?请参阅手册部分17.5 定位节点
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes.geometric}
\begin{document}
\begin{tikzpicture}
\draw[very thin,black!50, step=0.5] (-1,-1) grid (6,6);
\draw[->,>=stealth',very thick] (-1,0)--(6,0);
\draw[->,>=stealth',very thick] (0,-1)--(0,6);
\draw (0,0) .. controls (1,1) and (-5,1) .. (6,6)
\foreach \p/\l in {0.2/A,0.4/B,0.6/C,0.8/D} {node[pos=\p,label=$\l$,anchor=base](\l) {}};
\foreach \l in {A,B,C,D} {\draw[fill] (\l) circle (2pt);}
\draw[red, thick, ->, >=stealth'] (C.center) -- +(2,1) node[right] {$\vec F_C$};
\end{tikzpicture}
\end{document}