# Counter-clockwise angle between edges

I have a couple of connected lines (or rather edges) in the form of coordinates, that is for each edge a starting point $(x_s,y_s)$ and end point $(x_e,y_e)$. and I want to know a specific angle between them. Here is a drawing to illustrate which angles I want: The blue arrows are (in this case 4) edges. The orange-like pieces of a circle are supposed to show the desired angles. That is, I want the counter-clockwise angle of the respective second edge to the respective first edge. How do I do that?

• What are your prior knowledge? Do you know complex numbers for example? – skyking Jun 20 '16 at 13:03
• If they're just in a picture like that, you would need a protractor. If you have some other kind of information (coordinates, equations, etc.) then the procedure will depend greatly on exactly what kind of information you have about the edges. So my question is: what, exactly, is the kind of information you have available? – Arthur Jun 20 '16 at 13:04
• my knowledge about complex numbers is very limited. @Arthur: i have added which information i have available (i know the coordinates of the edges). – user1809923 Jun 20 '16 at 13:12

Using the start and end point, you can determine the related vector like this $(x_e-x_s, y_e-y_s)$. Then, you have the vectors, and you can compute the angles using the interior product. Assume a and b are two vectors, then the angle between them can be computed using the following.
$$\cos(\theta)=\frac{\mathbf {a \cdot b}}{\mathbf {|a||b|}}$$
Please note that this angle is not always the one you are looking for, and you may need to consider $\pi-\theta$ as the one which you need to find.
• Sorry, but I can't really apply your solution - since I do not know when to choose $\theta$ and when $\pi - \theta$ ... – user1809923 Jun 21 '16 at 5:46
• @user1809923 In fact, $\theta$ is the angle between two vectors when the origin of them is the same. So, in your case, for all the three angles, you should consider $\pi - \theta$. – Majid Jun 21 '16 at 13:13