3
$\begingroup$

Given the following image:

$\hskip{1.5 in}$ enter image description here

Supposing $A(100, 300)$ and $B(300, 100)$, how can I find the angle $\alpha$ between A and B?

On a side note, what's the main difference between a point and a vector? translating a point to a vector is as simple as Point = Vector? Sometimes I find articles where the terms are interchangable

  • 0
    ok, how should I edit my main question in order to describe that I want to know angle alpha? Thank you :)2012-04-03

3 Answers 3

5

Hint: You may have been taught about the dot product, perhaps something like $\mathbf{a} \cdot \mathbf{b}=\left\|\mathbf{a}\right\| \, \left\|\mathbf{b}\right\| \cos \theta$ so how might you apply that here?

  • 1
    Yes (though you might want to take care about the sign)2012-04-03
3

The Atan2 function in most computer languages will take the coordinates of a point and give the angle from the origin to that point. If you take Atan2$(B_x,B_y)-$Atan2$(A_x,A_y)$ you will have it, to within multiples of $2\pi$. If you use the usual arctangent you need to worry about which quadrant you are in.

Points are exactly that, locations in the plane (in 2D). Vectors are things with a length and a direction. You can make a correspondence between a point and the vector from the origin to that point, which seems to be what you are doing. But a vector can also be from (1,2) to (4,8), for example. This vector has coordinates (3,7).

2

Let $A={A_x \choose A_y}$. Then you subtract the angle $\angle A$ (between $A$ and the $x$-axis) from $\angle B$ (the angle between $B$ and the $x$-axis).

Use the inverse of $\tan(\angle A)=\frac{A_y}{A_x}$ to get $\alpha= \tan^{-1}(\frac{A_y}{A_x})-\tan^{-1}(\frac{B_y}{B_x})$.