If the values ββof x and z do not change, then the calculation is very simple: just use basic trigonometry.
Let the points (x, y1, z) and (x, y2, z) . You can find out the angle that the vector makes with the ZX plane. Let the angles t1 and t2 respectively. Then:
w = sqrt(x^2 + z^2) tan(t1) = y1 / w So t1 = atan(y1 / w) Similarly t2 = atan(y2 / w) The angle is (t2 - t1)
There is one mistake: when both x and z are equal to zero, tan are undefined ... but such a trivial case can be easily handled separately.
Unfortunately, there is no way to avoid the square root.
source share