## CV_COORD

The CV_COORD function converts 2D and 3D coordinates between the rectangular, polar, cylindrical, and spherical coordinate systems.

If the value passed to the "FROM_" keyword is double precision, then all calculations are performed in double precision and the returned value is double precision. Otherwise, single precision is used. If none of the "FROM_" keywords are specified, 0 is returned. If none of the "TO_" keywords are specified, the input coordinates are returned.

This routine is written in the IDL language. Its source code can be found in the file ``` cv_coord.pro``` in the ``` lib``` subdirectory of the IDL distribution.

### Calling Sequence

Result = CV_COORD()

### Arguments

This function has no required arguments. All data is passed in via keywords.

### Keywords

#### DEGREES

If set, then the input and output coordinates are in degrees (where applicable). Otherwise, the angles are in radians.

#### FROM_CYLIN

A vector of the form [ angle , radius , z ], or a (3, n ) array of cylindrical coordinates to convert.

#### FROM_POLAR

A vector of the form [ angle , radius ], or a (2, n) array of polar coordinates to convert.

#### FROM_RECT

A vector of the form [ x , y ] or [ x , y , z ], or a (2, n ) or (3, n ) array containing rectangular coordinates to convert.

#### FROM_SPHERE

A vector of the form [ longitude , latitude , radius ], or a (3, n ) array of spherical coordinates to convert.

#### TO_CYLIN

If set, cylindrical coordinates are returned in a vector of the form [ angle , radius , z ], or a (3, n ) array.

#### TO_POLAR

If set, polar coordinates are returned in a vector of the form [ angle , radius ], or a (2, n) array.

#### TO_RECT

If set, rectangular coordinates are returned in a vector of the form [ x , y ] or [ x , y , z ], or a (2, n ) or (3, n ) array.

#### TO_SPHERE

If set, spherical coordinates are returned in a vector of the form [ longitude , latitude , radius ], or a (3, n ) array.

### Examples

Convert from spherical to cylindrical coordinates:

sph_coord = [[45.0, -60.0, 10.0], [0.0, 0.0, 0.0]]

rect_coord = CV_COORD(FROM_SPHERE=sph_coord, /TO_CYLIN, /DEGREES)

Convert from rectangular to polar coordinates:

rect_coord = [10.0, 10.0]

polar_coord = CV_COORD(FROM_RECT=rect_coord, /TO_POLAR)