---
title: "rectangularToPolar(_:)"
framework: accelerate
role: symbol
role_heading: Type Method
path: "accelerate/vdsp/rectangulartopolar(_:)-5p4kg"
---

# rectangularToPolar(_:)

Returns single-precision polar coordinates converted from rectangular coordinates.

## Declaration

```swift
static func rectangularToPolar<U>(_ rectangularCoordinates: U) -> [Float] where U : AccelerateBuffer, U.Element == Float
```

## Parameters

- `rectangularCoordinates`: The source rectangular coordinates.

## Discussion

Discussion The function calls the underlying vDSP_polarD function to convert the input angle-radius pairs to Cartesian x-y pairs. The following code shows how to convert a set of Cartesian coordinates to its angle-radius pair (with the angle specified in degress) equivalent:    let rectangularCoordinates: [Float] = [ 5.0, 5.0 ]

let polarCoordinates = vDSP.rectangularToPolar(rectangularCoordinates)          let radius = polarCoordinates[0]     let angle = Measurement(value: Double(polarCoordinates[1]),                             unit: UnitAngle.radians)         .converted(to: UnitAngle.degrees)         .value          // Prints "7.07 45.0".     print(radius, angle)

## See Also

### Converting rectangular coordinates to polar coordinates

- [rectangularToPolar(_:)](accelerate/vdsp/rectangulartopolar(_:)-3txg1.md)
- [convert(rectangularCoordinates:toPolarCoordinates:)](accelerate/vdsp/convert(rectangularcoordinates:topolarcoordinates:)-1zi4t.md)
- [convert(rectangularCoordinates:toPolarCoordinates:)](accelerate/vdsp/convert(rectangularcoordinates:topolarcoordinates:)-84131.md)
