# How to draw a point at a given arclength along a curve in Tikz?

Consider following example:

\documentclass{report}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) arc (0:90:1 and 2);
\filldraw (0,0) circle (2pt);
\filldraw[red] (-.1,.9) circle (2pt);
\end{tikzpicture}
\end{document}


Given a curve and an origin (A in the example), I would like to place a point on the curve at a given arclength from the origin (B at an arclength 1 in the example).

How can I achieve this? I found this question and this question, but do not see how to specify the arclength.

This can be done (approximately) with decorations.markings, which accepts lengths (as well as percentages) for its position.

All markings in the image are at 1cm.

Define a style arclen that takes a length as its argument. Then \draw[arclen=1cm] <path> will make the mark at 1cm from the start.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary {decorations.markings}

\tikzset{arclen/.style={decoration={markings, mark=at position #1 with{\filldraw[red] (0,0) circle (2pt);}},
postaction=decorate}}

\begin{document}
\begin{tikzpicture}
\draw[gray!50, very thin](0,-1) grid (-2,2);
\draw[arclen=1cm] (0,0) -- (0,2);
\draw[arclen=1cm] (0,0) arc (0:90:1 and 2);
\draw[arclen=1cm] (0,0) arc (0:180:1);
\draw[arclen=1cm] (0,0) arc (0:270:.5);
\draw[arclen=1cm] (0,0) arc (0:330:.4);
\draw[arclen=1cm] (0,0) arc (0:330:.3);
\end{tikzpicture}
\end{document}

• +1. Really interesting, especially if we know that the length may be defined by an integral not expressed by elementary functions. May 21 at 1:31
• @PrzemysławScherwentke the “curve” is really a sequence of line segments. So there’s no integral involved. Just a sum. I suspect that if you tried this on a segment with large curvature you would see some inaccuracies. But I haven’t looked at the raw code to see how tikz calculates the number of points. May 21 at 2:16
• This is so nice, I didn't know it, thanks Sandy. +1 May 21 at 7:46
• @SebGlav: Glad I could show you something new for a change. It's usually the other way around. May 21 at 14:57