# Finding lower bound of a tangency point along the spheroid

I am using GeographicLib to calculate the distance between two points, let us say, $$A$$ and $$G$$ on the surface of the spheroid (WGS84). Let us say, my location is at point $$F$$, a distance of $$h$$ above $$A$$ along the normal line to the spheroid. I draw tangent(s) line(s) in the direction of $$G$$, so I have two point of tangency, one at east $$E$$ and the other at west $$W$$. I would to find this tangency point, for example, $$E$$, my approach is to starting stepping small distance from $$A$$ to infinity along the arc of the ellipse (the intersection of the spheroid and the plane defined by $$A$$, $$G$$, and the origin point $$O$$), when the two vectors $$GF$$ and $$GJ$$ (with $$J$$ a random point above $$G$$ along its normal to the spheroid) are perpendicular, I stop stepping because the tangency point is found. My question is as follows, is there a possibility to have lower bound to this point of tangency so instead I start with stepping from distance $$d=0$$ from $$A$$, then I could start from there till the vectors are perpendicular? I tried to find that visually with geogebra, for example, assuming a sphere then easily calculate the distance to tangency then take it as bound, but if fails, because it is sometimes lower bound and somentimes upper bound, it's dependent of the latitude and the height of the location.

My illustration

Edit

Updated illustration in 3D the blue ellipse is at the meridian plane of $$F$$ from North cw I choose an azimuth then search to find the tangency points. Notice $$J$$ here is not $$J$$ in the first illustration

• This is unclear. You introduce $G$ as if it were already given, then you talk about a tangency point $E$, but then you stop talking about $E$ and we are looking for two perpendicular vectors defined by $G$ and other points, There is no $E$ in your diagram. Is $G$ a point you already know, or a point you are trying to find? What happened to $E$? – David K Nov 28 '19 at 13:39
• Are you aware that the distance between points on a spheroid is given by a geodesic path that does not lie in a single plane and is not an arc of an ellipse? – David K Nov 28 '19 at 13:41
• If the two points whose distance you want to calculate both lie on the same line of longitude, as it appears they might in the illustration, then the path is an ellipse as shown there. It is not clear from the description whether you mean to be looking at a pair of points of that kind. – David K Nov 29 '19 at 2:17
• thanks David, you warned me from that, I didnt notice that, I should not use Geographiclib because it yields the distance along a geodesic, I should calculate the ellipse of intersection of the spheroid and the plane defined by $A$, $G$ and $O$. but all what I would know is, having a point above the surface of spheroid, how to find the points of tangency in the direction of $G$, all what I know is the equation of the polar plane of F w.r.t. – Khaled Nov 29 '19 at 8:20
• The point $G$ is there to give me the direction in that, I want to find the tangency points from $F$ to spheroid. they are not necessarily at same longitude or latitude. just a location at F then choosed azimuth from North clockwise, then find the two tangency points from $F$, a point aside and the other on other side. – Khaled Nov 29 '19 at 8:25

## 1 Answer

The problem for an ellipse in a general plane through the center of the spheroid is more complicated than the problem for a line of longitude. Among other things, if $$A$$ is a point on the ellipse and the vector from $$A$$ to $$F$$ is orthogonal to the surface of the spheroid at $$A$$, then $$F$$ is not in the plane of the ellipse, so there is no line from $$F$$ tangent to the ellipse. There is a point $$E$$ such that the line $$FE$$ is tangent to the spheroid at $$E,$$ but the line $$FE$$ will make a non-zero angle with the tangent to the ellipse at $$E.$$

There are ways to solve this directly using analytic geometry. For example, you can parameterize the ellipse so that you get $$(x,y,z)$$ coordinates of any point on the ellipse from one parameter, you can write an equation for the tangent plane at an arbitrary point $$(x,y,z)$$ on the spheroid, and then you can solve for the value of the parameter that makes the tangent plane pass through the coordinates of $$F.$$

A more geometric approach is to transform the coordinates so that the spheroid becomes a sphere. In the illustrations, it appears that your spheroid has semiminor axis $$16$$ (in the $$z$$ direction) and semimajor axis $$20$$ (in the $$x$$ and $$y$$ directions), so the transformation $$z \mapsto \frac54 z$$ would make a sphere. You have to transform everything the same way, so the $$z$$ coordinates of the points $$A$$ and $$G$$ that define your ellipse and of the point $$F$$ would all be multiplied by $$\frac54$$ in order to find the transformed points $$A',$$ $$G'$$, and $$F'.$$

This transformation preserves some relationships that are important to this problem: collinear points map to collinear points, coplanar points map to coplanar points, and tangents to curves or surfaces map to tangents to curves or surfaces; but it does not preserve some other relationships, such as non-zero angles. For example, the transformed vector $$A'F'$$ would not be perpendicular to the surface of the sphere at $$A'.$$ (In fact, this is one way to show that $$F$$ is not in the plane of the ellipse through $$A$$ and $$G$$ on the spheroid: if it were, it would map to a point in the plane of the great circle through $$A'$$ and $$G'.$$)

Let $$O$$ be the center of the sphere and let $$F''$$ be the point on the sphere directly between $$O$$ and $$F'.$$ Then $$OF'' = OE' = OA',$$ that is, these are all radii of the sphere. We want $$F'E'$$ to be perpendicular to $$OE',$$ which occurs when $$\cos \angle F'OE' = OF'/OE'$$ and $$\tan\angle F'OE' = E'F'/OE'.$$ So in one way or another you can determine $$\angle F'OE',$$ and of course $$\angle F''OE' = \angle F'OE'.$$

Since $$AF$$ is orthogonal to the spheroid at $$A,$$ it follows that $$F$$ is in the plane of the line of longitude through $$A$$ on the spheroid and therefore $$F'$$ is in the plane of the line of longitude through $$A'$$ on the sphere and $$F''$$ is on that line of longitude. Using the coordinates of $$A'$$ and $$F'$$ you can determine the angle $$\angle A'OF',$$ which is equal to $$\angle A'OF''$$; one way is by using the cross product of the vectors in the formula $$\lvert \vec{OA'} \times \vec{OF'}\rvert = \lvert \vec{OA'}\rvert \lvert\vec{OF'}\rvert \sin\angle A'OF'$$, but you can also convert the coordinates of $$A'$$ and $$F''$$ to spherical coordinates, in which case the angle $$\angle A'OF''$$ is just the difference in latitude. Using other vector formulas or spherical coordinates (your choice) you can also determine the angle $$\angle A'OG'$$ and the angle that the great circle through $$A'$$ and $$G'$$ makes with the line of longitude through $$A',$$ which will be the angle $$\angle A'$$ in the spherical triangle $$\triangle A'E'F''.$$

So you would now have two of the "sides" (arcs) of the spherical triangle $$\triangle A'E'F''$$ and one of its angles, which is enough information to find the angle $$\angle A'OE'$$ by spherical trigonometry, which in turn will enable you to find the spherical coordinates of $$E'$$, which you can convert to Cartesian coordinates. Then invert the transformation from the sphere back to the spheroid (by multiplying the $$z$$ coordinate by $$\frac45$$) in order to obtain the coordinates of $$E.$$

There are quite a few steps to this procedure but it is a direct, exactly solution, not an iterative solution ("stepping" along the ellipse) or an approximation.

A variation on this approach that might be simpler is to find the point $$F'''$$ on the line segment between $$O$$ and $$F'$$ such that $$OF''' = OA' \cos\angle F'OE',$$ find the equation of the plane through $$F'''$$ perpendicular to $$OF''',$$ and then find the intersections of that plane with the great circle through $$A'$$ and $$G'$$. One way to do that is to find the equation of the plane through $$O,$$ $$A',$$ and $$G',$$ whose intersection with the plane through $$F'''$$ is a line, and find the two points on that line at distance $$OA'$$ from $$O$$; one of those points is $$E'$$.

There are additional ways to solve the problem on the sphere using vector arithmetic.

• There are hints toward several kinds of solution in this answer. I still have some concern about why you are working on this problem, because I strongly suspect it might be for the wrong reasons. I can't think of any useful application of this problem, whereas I can easily think of applications that are almost (but not quite) the same. – David K Nov 29 '19 at 16:21
• My problem is as follows, at a location, let us say, $P$ above the spheroid along its normal line, to find the coordinates of tangency point from a ray drawn from $P$ to the surface of spheroid at a given bearing starting from North cw, therefore I thought so, but if you have a easier method, feel you free to add it if you want or to edit my question, thank you – Khaled Nov 29 '19 at 18:17
• I will read your answer carefully when I am at home to understand what you helped me and corrected my errors. – Khaled Nov 29 '19 at 18:18
• In general, the angle between the ellipse and the line of longitude will not be exactly equal to the bearing from $P$ to the point of tangency, so as I suspected, the question as you asked it here does not solve the actual problem you are trying to solve. – David K Nov 29 '19 at 18:33
• Ok, I am sorry for that, I think I would ask a new question, directly what I search for, as I described in last comment, then delete this question, but I am thankfull for your time and you work – Khaled Nov 29 '19 at 18:41