Function

# vDSP_polar(_:_:_:_:_:)

Converts single-precision rectangular coordinates to polar coordinates, using the specified stride.

## Parameters

`__A`

Single-precision real input vector.

`__IA`

Stride for `A`, must be even.

`__C`

Single-precision output vector.

`__IC`

Stride for `C`, must be even.

`__N`

Number of ordered pairs processed.

## Discussion

This performs the following operation:

Converts rectangular coordinates to polar coordinates. Vector `A` defines Cartesian (x, y) pairs. The function writes polar (rho, theta) pairs, where rho is the radius and theta is the angle in the range `[-pi, pi]` to vector `C`. `N` specifies the number of coordinate pairs in `A` and `C`.

Coordinate pairs are adjacent elements in the array, regardless of stride; stride is the distance from one coordinate pair to the next.

The following code shows how to convert a single pair of rectangular coordinates to their polar equivalent.

On return, `radius` is `7.07`, and `angle` is `45`.

This function performs the inverse operation of `vDSP_rect`, which converts polar to rectangular coordinates.

## See Also

### Single-Vector Polar-Rectangular Conversion

`static func polarToRectangular<U>(U) -> [Double]`

Returns double-precision polar coordinates converted to rectangular coordinates.

`static func polarToRectangular<U>(U) -> [Float]`

Returns single-precision polar coordinates converted to rectangular coordinates.

`static func rectangularToPolar<U>(U) -> [Double]`

Returns double-precision rectangular coordinates converted to polar coordinates.

`static func rectangularToPolar<U>(U) -> [Float]`

Returns single-precision rectangular coordinates converted to polar coordinates.

`static func convert<U, V>(polarCoordinates: U, toRectangularCoordinates: inout V)`

Converts double-precision polar coordinates to rectangular coordinates.

`static func convert<U, V>(polarCoordinates: U, toRectangularCoordinates: inout V)`

Converts single-precision polar coordinates to rectangular coordinates.

`static func convert<U, V>(rectangularCoordinates: U, toPolarCoordinates: inout V)`

Converts double-precision rectangular coordinates to polar coordinates.

`static func convert<U, V>(rectangularCoordinates: U, toPolarCoordinates: inout V)`

Converts single-precision rectangular coordinates to polar coordinates.

`func vDSP_polarD(UnsafePointer<Double>, vDSP_Stride, UnsafeMutablePointer<Double>, vDSP_Stride, vDSP_Length)`

Converts double-precision rectangular coordinates to polar coordinates, using the specified stride.

`func vDSP_rect(UnsafePointer<Float>, vDSP_Stride, UnsafeMutablePointer<Float>, vDSP_Stride, vDSP_Length)`

Converts single-precision polar coordinates to rectangular coordinates, using the specified stride.

`func vDSP_rectD(UnsafePointer<Double>, vDSP_Stride, UnsafeMutablePointer<Double>, vDSP_Stride, vDSP_Length)`

Converts double-precision polar coordinates to rectangular coordinates, using the specified stride.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software