mice_nearpt

 Abstract I/O Examples Particulars Required Reading Version Index_Entries

Abstract

```
MICE_NEARPT calculates the point on the surface of an
ellipsoid nearest to a specified off-ellipsoid position.
The routine also returns the altitude of the position
above the ellipsoid

```

I/O

```
Given:

positn   the array(s) defining the Cartesian position of a point with
respect to the center of an ellipsoid. The vector is expressed
in a body-fixed reference frame. The semi-axes of the
ellipsoid are aligned with the x, y, and z-axes of the
body-fixed frame.

[3,n] = size(rectan); double = class(rectan)

a,       values of the ellipsoid's triaxial radii ellipsoid, where:
b,
c
'a' is length in kilometers of the semi-axis of the
ellipsoid parallel to the x-axis of the body-fixed
reference frame.

[1,1] = size(a); double = class(a)

'b' is length in kilometers of the semi-axis of the
ellipsoid parallel to the y-axis of the body-fixed
reference frame.

[1,1] = size(b); double = class(b)

'c' is length in kilometers of the semi-axis of the
ellipsoid parallel to the z-axis of the body-fixed
reference frame.

[1,1] = size(c); double = class(c)

the call:

[ npoint ] = mice_nearpt( positn, a, b, c )

returns:

npoint   the structure(s) containing the results of the calculation.

[1,n] = size(npoint); struct = class(npoint)

Each structure consists of the fields:

'pos'   the double precision 3-vector defining the location
in the body-fixed frame on the ellipsoid closest
to 'positn'

[3,1] = size(npoint(i).pos); double = class(npoint(i).pos)

'alt'   the double precision scalar altitude of 'positn'
above the ellipsoid. If 'positn' is inside the
ellipsoid, 'alt' will be negative and have magnitude
equal to the distance between 'pos' and 'positn'

[1,1] = size(npoint(i).alt); double = class(npoint(i).alt)

'npoint' returns with the same vectorization measure, N, as 'positn'.

```

Examples

```
Any numerical results shown for this example may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.

%
% Define the radii of an ellipsoid.
%
a  =  1.;
b  =  2.;
c  =  3.;

%
% Use point on the X axis, outside the ellipsoid.
%
point = [ 3.5; 0.; 0. ];
pnear = mice_nearpt( point, a, b, c);

MATLAB outputs:

pnear.pos

ans =

1
0
0

MATLAB outputs:

pnear.alt

ans =

2.50000000000000

MATLAB outputs:

%
% Load a meta kernel containing SPK and leapseconds kernels.
%
cspice_furnsh( 'standard.tm')

%
% Retrieve the position of the Moon wrt the Earth at
% ephemeris time 0.d (Jan 1 2000 12:00 TDB) in the Earth-fixed
% reference frame.
%
epoch  = 0.;
abcorr = 'LT+S';
loc    = mice_spkpos( 'moon', epoch, 'IAU_EARTH', abcorr, 'earth' );

%
% Retrieve the triaxial radii for Earth (body ID 399).
%

%
% Now calculate the point on the Earth nearest to the Moon
% given LT+S aberration correction at the epoch time.
%

MATLAB outputs:

npoint.pos

ans =

1.0e+03 *

3.34708386495926
-5.29453888129091
-1.19828126398311

MATLAB outputs:

npoint.alt

ans =

3.960372197033597e+05

```

Particulars

```
A sister version of this routine exists named cspice_nearpt that returns
the structure field data as separate arguments.

```

```
For important details concerning this module's function, please refer to
the CSPICE routine nearpt_c.

MICE.REQ

```

Version

```
-Mice Version 1.0.1, 03-DEC-2014, EDW (JPL)

Edited I/O section to conform to NAIF standard for Mice documentation.

-Mice Version 1.0.0, 21-DEC-2005, EDW (JPL)

```

Index_Entries

```
distance from point to ellipsoid
nearest point on an ellipsoid

```
`Wed Apr  5 18:00:36 2017`