find the angle between 2 points in space and the line vertical to one of them.

81 Views Asked by At

I wanted to calculate the angle between 2 points in space and the line, which is vertical to one of them. for example, we got p1(x1,y1,z1) and p2(x2,y2,z2) and a line which is parallel to z axis and vertical to p1. Is there any formula for this?

I found out, that'll be arccos(v . <0,0,1>) for z axis. is that correct? In other words, if we create a vector out of the points, lets say (100i-50j+10k) it would be: (100i-50j+10k).(0i +0j +zk) = | 100i-50j+10k | |0i +0j+ zk| cosθ and it can be simplified to: cosθ = 10/(100^2 + 50^2 + 10^2)^1/2

Thanks.

1

There are 1 best solutions below

1
On BEST ANSWER

In general, the cosine of the angle between two vectors is $$\cos\alpha=\frac{\vec a\cdot\vec b}{|\vec a||\vec b|}$$ In your case $\vec a = (x_2-x_1, y_2-y_1, z_2-z_1)$ and $\vec b=(0,0,1)$. When you plug these into the above formula you get $$\cos\alpha=\frac{z_2-z_1}{\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}}$$