
Tikz でベジェ曲線を定義したとします。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) .. controls (1,2) and (2,-1) .. (4,0);
\end{tikzpicture}
\end{document}
曲線に沿った座標、たとえば曲線の 30% と 60% の位置を見つけたいです。それらの位置を赤い点で示し、座標から始まってさまざまな方向に矢印を描きます。
ベジェ曲線に沿った座標を返す簡単なコマンドはありますか? ありがとうございます。
答え1
markings
ベジェ曲線を含む任意のパスで使用できます。mark=at position 0.30
パスに沿って 30% のマーキングを意味します。
\documentclass[border=0.2 cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.markings,arrows}
\begin{document}
\begin{tikzpicture}[%
decoration={markings,
mark=at position 0.30 with {\coordinate (A); \fill[red] circle [radius=2pt];},
mark=at position 0.60 with {\coordinate (B); \fill[red] circle [radius=2pt];}
}]
\draw[postaction={decorate}] (0,0) .. controls (1,2) and (2,-1) .. (4,0);
\draw[->] (A) -- (1,1);
\draw[->] (B) -- (2,2);
\end{tikzpicture}
\end{document}