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.
If set, then the input and output coordinates are in degrees (where applicable). Otherwise, the angles are in radians.
A vector of the form [ angle , radius , z ], or a (3, n ) array of cylindrical coordinates to convert.
A vector of the form [ angle , radius ], or a (2, n) array of polar coordinates to convert.
A vector of the form [ x , y ] or [ x , y , z ], or a (2, n ) or (3, n ) array containing rectangular coordinates to convert.
A vector of the form [ longitude , latitude , radius ], or a (3, n ) array of spherical coordinates to convert.
If set, cylindrical coordinates are returned in a vector of the form [ angle , radius , z ], or a (3, n ) array.
If set, polar coordinates are returned in a vector of the form [ angle , radius ], or a (2, n) array.