The blue conics in the figure is an ellipse (it would be in a case a circle), that represents the tangency points, from the line drawn from the point $P$ to the ellipsoid surface in all direction, that means, it is the horizon of the point $P$.
My question: How to calculate the coordinates in $x,y,z$ of a point $M$, that lies on the horizon, and it has a bearing (azimuth) $\theta$ from (true) North clockwise?
My input data are the coordinates of P in terms of cartesian coordinates $X_p,Y_p,Z_p$
Thanks for help and tips in advance
$x = (N+hgt)*cos(lat)*cos(lon)$ $y = (N+hgt)*cos(lat)*sin(lon)$ $z = ((1-e^2)*N + hgt)*sin(lat)$
With $N = a/sqrt(1 - e^2*sin(lat)^2)$
$hgt:$ height above ellipsoid surface along the normal.
Setting $hgt=0$, that yields the position of $Q$ bcz it has the same coordinates as $P$, just it lies on the surface