<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/convert(rectangularCoordinates:toPolarCoordinates:)-1zi4t",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO7convert22rectangularCoordinates07toPolarE0yx_q_ztAA0A6BufferRzAA0a7MutableH0R_Sf7ElementRtzSfAIRt_r0_lFZ"
  },
  "title" : "convert(rectangularCoordinates:toPolarCoordinates:)"
}
-->

# convert(rectangularCoordinates:toPolarCoordinates:)

Converts single-precision rectangular coordinates to polar coordinates.

```
static func convert<U, V>(rectangularCoordinates: U, toPolarCoordinates polarCoordinates: inout V) where U : AccelerateBuffer, V : AccelerateMutableBuffer, U.Element == Float, V.Element == Float
```

## Parameters

`rectangularCoordinates`

The source rectangular coordinates.

`polarCoordinates`

On output, the polar coordinates.

## Discussion

The function calls the underlying [`vDSP_polarD`](/documentation/Accelerate/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:

```swift
    let rectangularCoordinates = [ 5.0, 5.0 ]

    let polarCoordinates = [Double](unsafeUninitializedCapacity: 2) {
        buffer,initializedCount in
        
        vDSP.convert(
            rectangularCoordinates: rectangularCoordinates,
            toPolarCoordinates: &buffer
        )
        
        initializedCount = 2
    }
    
    let radius = polarCoordinates[0]
    let angle = Measurement(value: polarCoordinates[1],
                            unit: UnitAngle.radians)
        .converted(to: UnitAngle.degrees)
        .value
    
    // Prints "7.07 45.0".
    print(radius, angle)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)