Intersection of a half-ray with an ellipsoid.
[psol1,psol2,numsol] = CL_gm_inters3dLineEllips(pos,u [,posc,er,obla])
Computes the intersection(s) of a half-ray (i.e. half-line) with an ellipsoid of revolution.
The half-ray is defined by its origin pos and direction u.
The ellipsoid is an ellipsoid of revolution around the z-axis, and is defined by its centre posc, radius er and oblateness obla.
There can be 0,1 or 2 intersections.
If there are 2 intersections, psol1 is the closest to pos (and in the direction of u).
If psol1 or psol2 do not exist, [%nan;%nan;%nan] is returned.
Note: Due to numerical errors, the altitudes with respect to the ellipsoid might be slightly negative. One way around is to force the altitude to 0 (after a call to CL_co_car2ell).
Origin of the half-ray (3xN or 3x1)
Direction of the half-ray (not necessarily a unit vector) (3xN or 3x1)
(optional) Position of the centre of the ellipsoid. Default is [0;0;0]. (3x1)
(optional) Ellipsoid equatorial radius [m]. Default is %CL_eqRad. (1x1)
(optional) Ellipsoid oblateness. Default is %CL_obla. (1x1)
First solution, %nan*[1;1;1] if there is no intersection. (3xN)
Second solution, %nan*[1;1;1] if there are less than 2 intersections. (3xN)
Number of solutions for convenience: 0,1 or 2 (1xN)
CNES - DCT/SB