---
title: vDSP_rectD
framework: accelerate
role: symbol
role_heading: Function
path: accelerate/vdsp_rectd
---

# vDSP_rectD

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

## Declaration

```occ
extern void vDSP_rectD(const double *__A, vDSP_Stride __IA, double *__C, vDSP_Stride __IC, vDSP_Length __N);
```

## Parameters

- `__A`: The input vector that contains adjacent pairs of coordinates.
- `__IA`: The distance between the adjacent coordinate pairs of elements in the input vector. This value must be an even number.
- `__C`: On output, the output vector that contains adjacent pairs of coordinates.
- `__IC`: The distance between the adjacent coordinate pairs of elements in the output vector. This value must be an even number.
- `__N`: The number of ordered pairs that the function processes.

## Discussion

Discussion The function uses the following calculation to convert polar coordinates to rectangular coordinates: for (n = 0; n < N; ++n) {     r     = A[n*IA+0];     theta = A[n*IA+1];     C[n*IC+0] = r * cos(theta);     C[n*IC+1] = r * sin(theta); } Vector A defines the input polar (rho, theta) pairs, where rho is the radius and theta is the angle in the range [-pi, pi]. The function writes Cartesian (x, y) pairs to the output 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 an angle-radius pair (with the angle specified in degress) to its rectangular equivalent. let angle = Measurement(value: 45,                         unit: UnitAngle.degrees)     .converted(to: UnitAngle.radians)     .value

let radius = sqrt(25.0 + 25.0)

let polarCoordinates = [radius, angle]

var rectangularCoordinates: [Double] = [0, 0]

let stride = vDSP_Stride(2) let n = vDSP_Length(1)

vDSP_rectD(polarCoordinates, stride,            &rectangularCoordinates, stride,            n) On return, rectangularCoordinates contains [5, 5]. This function performs the inverse operation of vDSP_polarD, which converts rectangular to polar coordinates.

## See Also

### Converting polar coordinates to rectangular coordinates

- [vDSP_rect](accelerate/vdsp_rect.md)
