
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}