Danijel
Danijel

Reputation: 8610

Faster way to go from cartesian to polar in C?

My C code for discrete Fourier transform needs to output polar values, amplitude and angle. I have a fast algorithm that outputs cartesian values, x and y.

Is there a faster way of converting (f.e. 1024) cartesian values to polar than just:

int x, y;
float amplitude, angle;
...
amplitude = sqrt( x*x + y*y);
angle = atan2( y, x );

?

Upvotes: 2

Views: 2384

Answers (2)

Mo Abdul-Hameed
Mo Abdul-Hameed

Reputation: 6110

I suggest that you read about CORDIC, check out this article.

Upvotes: 1

lxg
lxg

Reputation: 226

There are two approaches:

(1) Perform the common 2D FFT, and then complete the cartesian to polar conversion by yourself.

(2) Use the so called "polar FFT" directly. Actually, the "polar FFT" is also based on the interpolation.

Upvotes: 1

Related Questions