4

Let's say I defined a Bezier curve in Tikz:

\documentclass{article}
\usepackage{tikz}

\begin{document} 
\begin{tikzpicture}
 \draw (0,0) .. controls (1,2) and  (2,-1) .. (4,0);
\end{tikzpicture}
\end{document} 

I want to find coordinates along the curve, e.g. at 30% and 60% along the curve. I want to indicate their position with a red dot and draw arrows, starting at the coordinates, into different directions.

Is their a simple command that returns coordinates along a Bezier curve? Thank you.

4

You can use markings on any path including a bezier curve. mark=at position 0.30 means a marking 30% along the path.

\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}

Bezier curve with markings

  • This is exactly what I was looking for. Thanks a lot! :) – miga89 Jan 23 '17 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.