Calculating the angle between a direction and a point

1.1k Views Asked by At

I got two points and one them with a direction (with pitch and yaw, not actually coordinates), so we got point $a=(x_1, y_1 ,z_1)$, which is me and point $b=(x_2, y_2, z_2)$. There is a direction that its source is point b, $(pitch, yaw)$,

I want to find the angle that $b$ direction creates with me.

I started with subtracting $b-a$ so I will be able to calculate relative to $(0, 0, 0)$ which is easier... no idea how to continue tho

1

There are 1 best solutions below

0
On

You need to compute a vector in the pitch/yaw direction of interest. Then take the dot product with the vector $b-a$. The dot product is the product of the lengths of the vectors and the cosine of the angle between them, so you can get the cosine and then the angle.