cspice_reccyl

 Abstract I/O Examples Particulars Required Reading Version Index_Entries

#### Abstract

```
CSPICE_RECCYL converts rectangular (Cartesian) coordinates to
cylindrical coordinates.

```

#### I/O

```
Given:

rectan   the array(s) containing the rectangular coordinates of the
position or set of positions.

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

the call:

[r, lonc, z] = cspice_reccyl( rectan)

returns:

r      the value(s) describing the distance of the point of
interest from z axis.

[1,n] = size(r); double = class(r)

lonc   the value(s) describing the cylindrical angle of the point of
interest from the XZ plane measured in radians.

[1,n] = size(lonc); double = class(lonc)

z      the value(s) describing the height of the point above
the XY plane.

[1,n] = size(z); double = class(z)

The arguments 'r' and 'z' return in the same units associated
with 'rectan'.

'r', 'lonc', and 'z' return with the same vectorization
measure as 'rectan'.

```

#### 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.

Example (1):

%
% Load an SPK, leapseconds, and PCK kernel set.
%
cspice_furnsh( 'standard.tm' )

%
% Create a vector of scalar times.
%
et = [0:2]*2.*cspice_spd;

%
% Retrieve the position of the moon seen from earth at 'et'
% in the J2000 frame without aberration correction.
%
[pos, et] = cspice_spkpos( 'MOON', et, 'J2000', 'NONE', 'EARTH' );

%
% Convert the array of position vectors 'pos' to cylindrical
% coordinates.
%
[r, lonc, z] = cspice_reccyl(pos);

%
% Convert the cylindrical to rectangular.
%
[rectan] = cspice_cylrec(r, lonc, z);

%
% Calculate the relative error against the original position
% vectors.
%
(rectan-pos) ./ pos

MATLAB outputs:

1.0e-13 *

0.00199609007208                  0  -0.25513381329527
-0.00218237675815                  0  -0.00153127196389
0                  0                  0

The relative error between the original array of position vectors
and those that resulted from the various coordinate conversion
has magnitude on the order of 10^(-13).  A numerical
demonstration of equality.

Example (2):

%
% Define eleven sets of rectangular coordinates.
%
rec = [ [ 0., 1., 0., 0., -1., 0., 0., 1., 1., 0., 1. ]; ...
[ 0., 0., 1., 0., 0., -1., 0., 1., 0., 1., 1. ]; ...
[ 0., 0., 0., 1., 0., 0., -1., 0., 1., 1., 1. ]    ];

%
% ...convert the rectangular coordinates to cylindrical coordinates
%
[r, lonc, z] = cspice_reccyl(rec);

%
% Convert 'lonc' to degrees...
%
lonc = lonc * cspice_dpr;

%
% Output banner.
%
disp('     r         lonc        z           x         y           z   ')
disp('  --------   --------   --------   --------   --------   --------')

%
% Create an array of values for output.
%
output = [ r; lonc; z; rec(1,:); rec(2,:); rec(3,:) ];
txt    = sprintf( '%10.4f %10.4f %10.4f %10.4f %10.4f %10.4f\n', output);
disp( txt );

%
% It's always good form to unload kernels after use,
% particularly in MATLAB due to data persistence.
%
cspice_kclear

MATLAB outputs:

r         lonc        z           x         y           z
--------   --------   --------   --------   --------   --------
0.0000     0.0000     0.0000     0.0000     0.0000     0.0000
1.0000     0.0000     0.0000     1.0000     0.0000     0.0000
1.0000    90.0000     0.0000     0.0000     1.0000     0.0000
0.0000     0.0000     1.0000     0.0000     0.0000     1.0000
1.0000   180.0000     0.0000    -1.0000     0.0000     0.0000
1.0000   270.0000     0.0000     0.0000    -1.0000     0.0000
0.0000     0.0000    -1.0000     0.0000     0.0000    -1.0000
1.4142    45.0000     0.0000     1.0000     1.0000     0.0000
1.0000     0.0000     1.0000     1.0000     0.0000     1.0000
1.0000    90.0000     1.0000     0.0000     1.0000     1.0000
1.4142    45.0000     1.0000     1.0000     1.0000     1.0000

```

#### Particulars

```
None.

```

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

MICE.REQ

```

#### Version

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

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

-Mice Version 1.0.0, 22-NOV-2005, EDW (JPL)

```

#### Index_Entries

```
rectangular to cylindrical coordinates

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