# How is arc defined in TikZ?

Several questions about how arc is computed:

1. The start and end angles seem to be defined relative to the y axis, yet in the Tikz manual they are defined relative to the x axis. Is this right?

2. Is the end angle defined between the y (or x) axis and the incoming path, or between the y (or x) axis and the extension of the path beyond the endpoint?

3. Geometrically speaking, providing just the start and end angles (and radius) is not enough to define an arc unambiguously. Is there some other assumption, such as: Arcs must be less than 180 degrees? Or arcs must always curve counterclockwise?

\draw (x,y) arc (start:stop:radius); draws an arc

• with radius radius
• starts from (x,y)
• with center (x-r*cos(start), y-r*sin(start)) and
• ends at (x-r*cos(start)+r*cos(stop), y-r*sin(start)+r*sin(stop)).

For example,

 \draw[red] (0,0) arc (30:60:3);


draws an arc

• of radius 3
• starting from (0,0)
• with center (0+3*cos(30+180),0+3*sin(30+180)) and
• ending at (0+3*cos(30+180)+3*cos(60),0+3*sin(30+180)+3*sin(60)).

\draw[blue] (0,0) -- ++(30+180:3) -- +(60:3);


draw a blue line to the arc to make a complete sector as shown in the following figure. ## Minimal Working Example

\documentclass[tikz,border=12pt]{standalone}

\begin{document}
\foreach \start/\stop in {30/60,45/90,135/180,0/180,45/315}
{
\begin{tikzpicture}
\draw[lightgray,ultra thin] (-6,-6) grid (6,6);
\draw[red] (0,0) arc (\start:\stop:3);
\draw[blue] (0,0) -- ++(\start+180:3) -- +(\stop:3);
\node[anchor=north] at (0,6) {$(\start:\stop:3)$};
\end{tikzpicture}
}
\end{document}


## Other outputs for you to analyze    • Thank you very much. I was completely confused about the meaning of "start angle" and "end angle". I understand now! ---David B. – David Brown May 3 '14 at 17:12
• Just a remark on "(start:stop:radius)": both "(45:315:3)" and "(315:45:3)" draw 3/4 of a disk. To draw the missing 1/4 you need "(315:405:3)". – jpb Jan 6 '17 at 11:16
• @jpb: is there a way to force it to draw clockwise or anticlockwise? In my current application, I don't know what my start and stop angles will be in advance, but I know I want a clockwise arc from start to stop. Sometimes, I need to add 360, and sometimes I need to not. – Pi Fisher Feb 28 '18 at 19:14

For visualisation, here is a (badly hand-drawn) diagram: where

• theta_i is the start angle,
• theta_f is the end angle,
• R is the radius,
• O is the centre of rotation (not the origin),
• A is the starting point,
• B is the end point.

1) The start and end angles seem to be defined relative to the y axis, yet in the Tikz manual they are defined relative to the x axis. Is this right?

The start and end angle are defined with respect to the x-axis. That convention is widespread, so it shouldn't be surprising. Although the tikz manual (v3.0) actually doesn't spell that out anywhere, as far as I know, you can gather as much from the numerous examples that use the arcoperation therein.

2) Is the end angle defined between the y (or x) axis and the incoming path, or between the y (or x) axis and the extension of the path beyond the endpoint?

See my answer to 1).

3) Geometrically speaking, providing just the start and end angles (and radius) is not enough to define an arc unambiguously. Is there some other assumption, such as: Arcs must be less than 180 degrees? Or arcs must always curve counterclockwise?

The only assumptions are those specified in 1) and that the rotation is counterclockwise. This choice of orientation is also not spelled out in the manual either, but should also not be very surprising.

Moreover, you can have arcs that span more than 180 degrees (by having |\theta_f-\theta_i| > 180 degrees) and you can have arcs that curve clockwise (by having \theta_f<\theta_i).

• Why didn't use TikZ to draw the diagram? – kiss my armpit May 3 '14 at 15:46
• @IamwhoIsayIam Good point :) I just jotted that down and took a picture of it. So "laziness" is the answer to your question. – jub0bs May 3 '14 at 15:51
• I created the diagram for you with PSTricks here (click). – kiss my armpit May 3 '14 at 16:47
• @IamwhoIsayIam Nice. You should use it in your own answer. – jub0bs May 3 '14 at 18:08
• No. Because the labels are not relevant to my explanation. :-) – kiss my armpit May 3 '14 at 18:23