3
$\begingroup$

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: enter image description here 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?

$\endgroup$
  • $\begingroup$ What are your prior knowledge? Do you know complex numbers for example? $\endgroup$ – skyking Jun 20 '16 at 13:03
  • 1
    $\begingroup$ 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? $\endgroup$ – Arthur Jun 20 '16 at 13:04
  • $\begingroup$ my knowledge about complex numbers is very limited. @Arthur: i have added which information i have available (i know the coordinates of the edges). $\endgroup$ – user1809923 Jun 20 '16 at 13:12
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Hi! Thanks! I think basically I am looking for the solution to your "note". I have already seen how to compute the angle between to vectors :) $\endgroup$ – user1809923 Jun 20 '16 at 13:25
  • $\begingroup$ Hi. no problem. I hope it works. $\endgroup$ – Majid Jun 20 '16 at 14:30
  • $\begingroup$ Sorry, but I can't really apply your solution - since I do not know when to choose $ \theta $ and when $\pi - \theta $ ... $\endgroup$ – user1809923 Jun 21 '16 at 5:46
  • $\begingroup$ @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$. $\endgroup$ – Majid Jun 21 '16 at 13:13

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.