# Calculate arc central angle given the center, radius, start and end points of the arc

How can I calculate the angle at the center of an arc knowing radius and center, start, and end points? I know how to do that if I have the length of the arc, but in my case I don't have it.

• You also need to know the direction in which the arc is traced. There are two arcs with the same start and end points. – amd Apr 1 at 19:16

Vectors to the rescue!

I assume you're dealing with two dimensions. Let's say the center is $$(x_c, y_c)$$ and the end points are $$(x_1, y_1)$$ and $$(x_2, y_2)$$.

Transform the coordinates so that the center coincides with the origin, and we're dealing with position vectors. The vectors for the end points are $$\begin{pmatrix} x_1 - x_c \\ y_1 - y_c \end{pmatrix}$$ and $$\begin{pmatrix} x_2 - x_c \\ y_2 - y_c \end{pmatrix}$$.

The dot product of these two is $$(x_1-x_c)(x_2-x_c) + (y_1 - y_c)(y_2 - y_c)$$. It is also equal to the product of their magnitudes multiplied by the cosine of the angle between the vectors, which is also the central arc angle you want.

So $$(x_1-x_c)(x_2-x_c) + (y_1 - y_c)(y_2 - y_c)\\ = \sqrt{(x_1-x_c)^2 + (y_1 - y_c)^2}\cdot \sqrt{(x_2-x_c)^2 + (y_2 - y_c)^2} \cdot \cos \theta$$

This allows you to solve for $$\theta$$.

As per the comments below, be careful about whether you wish to compute the central angle of the minor arc or the major arc. It's quite trivial going from one to the other.

• Thank you very much – Mazin Apr 1 at 11:20
• There are two arcs with these end points. How do you know which one was meant? – amd Apr 1 at 19:18
• @amd That's just minor vs major arc, and it's quite easy to decide because the former angle is less than $\pi$ while the latter is greater (boundary case of semicircular arc when the angle is equal to $\pi$). To go from one to the other, the OP can just take $2\pi - \theta$. I don't think this is an insurmountable problem. – Deepak Apr 1 at 23:59
• And what did you base this arbitrary decision on? The problem as stated is underspecified. I agree that it’s a minor issue, but it underscores a tacit assumption that you’ve made in this answer. – amd Apr 2 at 0:45
• @amd I believe with your comment and mine, the OP already has ample information to decide what he/she wants. There is nothing more to be said. But in any case, I've edited my answer with a brief note. – Deepak Apr 2 at 1:44

Hint: try to compute the length of the arc from the data you have.