ORTHOGONAL DISTANCE FROM AN ELLIPSOID

Finding the orthogonal (shortest) distance to an el lipsoid corresponds to the ellipsoidal height in Geodesy. De spite that the commonly used Earth reference systems, like WGS-84, are based on rotational ellip soids, there have also been over the course of the years permanent scientific invest igations undertaken into different aspects of the triaxial ellipsoid. Geodetic research has traditionally been motivated by the need to approximate closer and closer the ph ysical reality. Several investigations have shown that the earth is approxi mated better by a triaxial ellipsoid rather than a rotational one Burša and Šima (1980) . The problem of finding the shortest distance is encountered frequently in the CartesianGeodetic oordinate transformation, optimization problem, fitting ellip soid, image processing, face recognition, computer games, and so on. We have chosen a triaxial ellipsoid for the reason that it possesess a general surface. Thus, t e minimum distance from rotational ellipsoid and sphere is found with the s ame algorithm. This study deals with the computation of the shortest distance from a point to a triaxial ellipsoid.


INTRODUCTION
Although ellipsoid (general or triaxial) equation Eq. ( 1) is quite simple and smooth but geodetic computations are quite difficult on the ellipsoid.The main reason for this difficulty is the lack of symmetry.Triaxial ellipsoid is generally not used in geodetic applications.Rotational ellipsoid (ellipsoid revolution, biaxial ellipsoid, spheroid) is frequently used in geodetic applications.
Today increasing GPS and satellite measurement precision will allow us to determine more realistic earth ellipsoid.Geodetic research has traditionally been motivated by the need to continually improve approximations of physical reality.
Geodetic research has traditionally been motivated by the need to approximate closer and closer the physical reality.Several investigations have shown that the earth is approximated better by a triaxial ellipsoid rather than a rotational one.
Furthermore, non-spherical celestial bodies such as planets, physical satellites, asteroids and comets can be modeled by a triaxial ellipsoid.Also, the present day accuracy requirements and the modern computational capabilities push toward the study on the triaxial ellipsoid as a geometrical and a physical model in geodesy and related interdisciplinary sciences Panou et al (2013).
First, the basic definition of ellipsoid starts with giving mathematical equations to explain the concepts.To show how computations of the shortest distance to an ellipsoid, are carried out, we solve this problem separately: standard ellipsoid and the shifted-oriented ellipsoid.The efficacy of the new algorithms is demonstrated through simulations.
When we look at the literature on this subject we see the various studies: Eberly (2008), Feltens (2009) and Ligas (2012).For the solution Eberly (2008) gives a method that is based on sixth degree polynominal.He has benefited from the largest root of 6th degree polynomial.Feltens (2009) gives a vector-based iteration process for finding the point on the ellipsoid.Ligas (2012) claims his method turns out to be more accurate, faster and applicable than Feltens method.The presented paper tries to give the shortest distance calculation not only for the ellipsoid in standard position but also the shifted-oriented ellipsoid.We could not find enough studies with numerical examples on this subject in the literature, especially for shifted-oriented ellipsoid.
Triaxial ellipsoid formulas are quite useful, because obtaining the rotational ellipsoid formula from triaxial ellipsoid formula is easy.For this, equatorial semiaxis are accepted equal to each other (a x =a y =a) which is sufficient on triaxial ellipsoid formula.Similarly to obtain sphere formula from rotational ellipsoid formula it is sufficient to take as (a = b= R) Bektas (2009).

Ellipsoid
An ellipsoid is a closed quadric surface that is analogue of an ellipse (see Figure1).Ellipsoid has three different axes (a x >a y >b).Mathematical literature often uses "ellipsoid" in place of "Triaxial ellipsoid or general ellipsoid".Scientific literatura (particularly geodesy) often uses "ellipsoid" in place of "biaxial ellipsoid, rotational ellipsoid or ellipsoid revolution".Older literature uses 'spheroid' in place of rotational ellipsoid.The standard equation of an ellipsoid centered at the origin of a cartesian coordinate system and aligned with the axes is given below.(http://en.wikipedia.org/wiki/Ellipsoid).
Figure 1 -The shortest distance on triaxial ellipsoid (standard position)

FINDING THE POINT ON THE ELLIPSOID
It can be proved that the shortest distance is along the surface normal.The first step is to find the projection of an external point denoted as P G (x G, y G, ,z G ) as shown in Figure1 onto this ellipsoid along the normal to this surface i.e. point P E (x E, y E, ,z E ) Feltens (2009), Ligas (2012).P G (x G, y G, ,z G ) is a point on the earth surface.This section is handled under two headings: first, the shortest distance from the standard ellipsoid, second, the shortest distance from the shifted-oriented ellipsoid.

The Shortest Distance from the Standard Ellipsoid
In this section, we assume that the ellipsoid is in standard position, in other words its axis is aligned and centered at the origin (Figure 1).We will discuss the other ellipsoid under the next title.The following definitions will be used.a x = equatorial semimajor axis of the ellipse a y = equatorial semiminor axis of the ellipse b = polar semi-minor axis of the ellipse λ = geodetic longitude ϕ = geodetic latitude h = P G P E : ellipsoid height : the shortest distance Feltens (2009) gives a vector-based iteration process for finding the point on the ellipsoid.Ligas (2012) claims his methods turn out to be more accurate, faster and applicable.Ligas' Method is based on solving nonlinear system of equation.Ligas' Method is as follows: In accordance with Figure1 a collinearity condition can be written between P E and P G The first stage begins with constructing two collinear vectors: a vector normal (n) to the ellipsoid (obtained from the gradient operator of a triaxial ellipsoid) in the point P E that may be expressed as (seen in Figure 1): Where (5) And a vector (h), the shortest distance, connecting points P G and P E , Figure 1: From the essentials of vector calculus, it is known that coordinates of collinear vectors are proportional with the constant factor k, thus, we may write: From the above Eq.( 8) Ligas wrote the below given three equations: (9.c)But only two of them are necessary to set a single variant of a system of nonlinear equations to be solved.In addition, the coordinates of P E must satisfy the equation of the triaxial ellipsoid i.e.
From Eqs(9.a),(9.b) and (9.c) three pairs of equations are obtained which together with fixed one Eq.(9.d) produce three variants of the system of equations to be solved in order to obtain the solution for P E .As a result, it is established three nonlinear sytems of equation: Case  2012) has been doing research on three different nonlinear system of equation in terms of run-time and the number of iterations.But in our opinion it is pointless.It is not possible to say one of the systems will yield better results than the others.The distinctions between the results of different systems are actually meaningless.The distinctions completely arise from rounding errors.Because only two of the three equations ((9.a), (9.b) and (9.c)) are independent.Hence we can choose any two of these three equations.For example, Case.1 is chosen and these three equations are linearized by Taylor series expansion and the system of equations is solved in order to obtain the solution for X The initial guesses for the point on the ellipsoid P E were chosen the same as in Feltens (2009), namely: For the solution of nonlinear system (9.a,9.b,9.d) to obtain the value for X is necessary the calculus of the Jacobi's Matrix Can be solved very easily in MATLAB or classically Thus an iterative solution scheme may be implemented by: If δ Ei is less than threshold, the iteration is stopped.After the first step is accomplished, finding P E on the ellipsoid, and having coordinates of P E , the shortest distance P G P E ,= h may easily be computed as: The following link can be used for the shortest distance and projection coordinates on triaxial ellipsoid Bektas (2014).http://www.mathworks.com/matlabcentral/fileexchange/46261-the-shortestdistance-from-a-point-to-ellipsoid.

The shortest distance from the shifted-oriented ellipsoid
In general, for shifted-oriented ellipsoid as in (Figure 2), the data point P G (X G, Y G, ,Z G ) can be rotated and translated to axis-aligned ellipsoid centered at the origin and the distances can be calculated in that system.For this conversion we utilize performed as follows by making use of ellipsoid's center coordinates (X o ,Y o ,Z o ) and the rotation angles (ε, ψ, ω) , in accordance with Figure 2 The shortest distance ( h ) calculation is made of the new converted coordinates P G (x G, y G, z G ) in standard position with the above procedure and the coordinates of P E (x E, y E, ,z E ) in standard position are found.To find the true coordinates of P E (X E, Y E , Z E ) we need to make a transformation as below: Here, R is 3D rotational matrix

Obtaining Ellipsoid Parameters from Conic Equation
Generally an ellipsoid is defined with 9 parameters.These parameters are; 3 coordinates of centre (X o ,Y o ,Z o ), 3 semi-axes (a x ,a y ,b) and 3 rotational angles (ε, ψ, ω) which represent rotations around x-,y-and z-axes respectively as shown in Figure2.These angles control the orientation of the ellipsoid.
If we know the conic equation, ellipsoid parameters can be calculated.Here is a conic equation Necessary conditions for this problem to have a unique solution are that n > = 9, (n: denotes the number of data point cartesian coordinates(x,y,z)) and the data points lie in general position (e.g., do not all lie is an elliptic plane).Throughout this paper, we assume that these conditions are satisfied.v = [ A B C D E F G H I ] T unknown conic parameters.
It is solved easily in the Least Square (LS) sense by MATLAB as below: If n=9 the solution is named exact solution.All data points are satisfy Eq. ( 21).If n>9 all data points do not satisfy Eq.( 21).The solution named is algebraic ellipsoid fitting.
In theory, the conditions that ensure a quadratic surface to be an ellipsoid have been well investigated and explicitly stated in analytic geometry textbooks.Since an ellipsoid can be degenerated into other kinds of elliptic quadrics, such as an elliptic paraboloid.Therefore a proper constraint must be added by Li and Griffiths (2004) gives the following definitions: However 4j-i 2 > 0 is just a sufficient condition to guarantee that an equation of second degree in three variables represent an ellipsoid, but it is not neccesary.In this paper, we assume that these conditions are satisfied.
After conical equation Eq. ( 21) is solved in the LS sense by Eq. ( 22), this section we determine the center, semi-axis and rotation angles of the ellipsoid using an algorithm from Yury Petrov's Ellipsoid Fit Method Petrov (2009).MATLAB script the following link http://www.mathworks.com/matlabcentral/ fileexchange/ 24693-ellipsoid-fit.
The solution of the above equation system which is established with conic coefficients gives us the coordinates of ellipsoid's center (X o ,Y o ,Z o ).
In order to find of semi-axis (a x ,a y ,b) and rotation angles (ε, ψ, ω) of the ellipsoid, we use the following M and T matrix, (31.c)

Numeric Example-1 (for standard ellipsoid)
In order to demonstrate the validity of the shortest distance algorithms presented above, a numerical example is given.The algorithm was implemented in MATLAB.The numerical computations in the triaxial case were carried out using Earth's geometrical parameters a x = 6378388.0000m,a y = 6378318.0000mand b= 6356911.9461m.
The following link can be used for shortest distance from a point to triaxial ellipsoid http://www.mathworks.com/matlabcentral/fileexchange/46261-theshortest-distance-from-a-point-to-ellipsoid.
Given P G point Cartesian coordinates x G = 3909863.9271m, y G =3909778.1230m , z G = 3170932.5016m.Finding the shortest distance to triaxial ellipsoid.
For this, we must firstly find P E point Cartesian coordinates.The initial guesses for the P E point on the ellipsoid are determined according to Eq.( 10) Finding P E point on the ellipsoid from P G point iteratively from Eqs.(12-16) ; i Xe i Ye i Ze i δx i δy i δz i 1 3912539.2956 3912410.4953 3162418.4019 -3283.630 -3240.634 8017.501 2 3909255.6655 3909169.8616 3170435.9034 -4.111 -4.111 -3.402 3 3909251.5547 3909165.7506 3170432.5016-0.000 -0.000 -0.000 x E = 3909251.5547my E =3909165.7506mz E =3170432.5016m The shortest distance P G P E ,= h may easily be computed as
Here are data points coordinates: x
b)P G (X G = 7 , Y G =22 , Z G = 31)The data point coordinates P G (x G, y G, z G ) (oriented-shifted to ellipsoid centre) projection coordinates P E (x E, y E, ,z E )The following link can be used for projection coordinates on triaxial ellipsoid http://www.mathworks.com/matlabcentral/fileexchange/46261-the-shortestdistance-from-a-point-to-ellipsoid

Table 1 -
The result of ellipsoid parameter