Next: Mathematical Constants, Previous: Rational Approximations, Up: Arithmetic [Contents][Index]
Transform Cartesian coordinates to polar or cylindrical coordinates.
The inputs x, y (, and z) must be the same shape, or scalar. If called with a single matrix argument then each row of C represents the Cartesian coordinate pair (x, y) or triplet (x, y, z).
The outputs theta, r (, and z) match the shape of the inputs. For a matrix input C the outputs will be column vectors with rows corresponding to the rows of the input matrix.
theta describes the angle relative to the positive x-axis measured in the xy-plane.
r is the distance to the z-axis (0, 0, z).
z, if present, is unchanged by the transformation.
The coordinate transformation is computed using:
theta = arctan (y / x) r = sqrt (x^2 + y^2) z = z
Note: For MATLAB compatibility, this function no longer returns a full coordinate matrix when called with a single return argument.
Transform polar or cylindrical coordinates to Cartesian coordinates.
The inputs theta, r, (and z) must be the same shape, or scalar. If called with a single matrix argument then each row of P represents the polar coordinate pair (theta, r) or the cylindrical triplet (theta, r, z).
The outputs x, y (, and z) match the shape of the inputs. For a matrix input P the outputs will be column vectors with rows corresponding to the rows of the input matrix.
theta describes the angle relative to the positive x-axis measured in the xy-plane.
r is the distance to the z-axis (0, 0, z).
z, if present, is unchanged by the transformation.
The coordinate transformation is computed using:
x = r * cos (theta) y = r * sin (theta) z = z
Note: For MATLAB compatibility, this function no longer returns a full coordinate matrix when called with a single return argument.
Transform Cartesian coordinates to spherical coordinates.
The inputs x, y, and z must be the same shape, or scalar. If called with a single matrix argument then each row of C must represent a Cartesian coordinate triplet (x, y, z).
The outputs theta, phi, r match the shape of the inputs. For a matrix input C the outputs will be column vectors with rows corresponding to the rows of the input matrix.
theta describes the azimuth angle relative to the positive x-axis measured in the xy-plane.
phi is the elevation angle measured relative to the xy-plane.
r is the distance to the origin (0, 0, 0).
The coordinate transformation is computed using:
theta = arctan (y / x) phi = arctan (z / sqrt (x^2 + y^2)) r = sqrt (x^2 + y^2 + z^2)
Note: For MATLAB compatibility, this function no longer returns a full coordinate matrix when called with a single return argument.
Transform spherical coordinates to Cartesian coordinates.
The inputs theta, phi, and r must be the same shape, or scalar. If called with a single matrix argument then each row of S must represent a spherical coordinate triplet (theta, phi, r).
The outputs x, y, z match the shape of the inputs. For a matrix input S the outputs are column vectors with rows corresponding to the rows of the input matrix.
theta describes the azimuth angle relative to the positive x-axis measured in the xy-plane.
phi is the elevation angle measured relative to the xy-plane.
r is the distance to the origin (0, 0, 0).
The coordinate transformation is computed using:
x = r * cos (phi) * cos (theta) y = r * cos (phi) * sin (theta) z = r * sin (phi)
Note: For MATLAB compatibility, this function no longer returns a full coordinate matrix when called with a single return argument.
Next: Mathematical Constants, Previous: Rational Approximations, Up: Arithmetic [Contents][Index]