Home > Software design >  Algorithm for plotting polar equations in general form
Algorithm for plotting polar equations in general form

Time:12-15

I'm looking for an algorithm, which can decide if a given point (x,y) satisfies some equation written in polar form, like r-phi=0. The main problem is that the angle phi is bounded between (0,2pi), so in this example I'm only getting one cycle of the spiral. So how can I get all the possible solutions for any polar equation written in such form?

Tried bounding r value to (0-2pi) range, which didn't work on some more complicated examples like logarithmic spirals

CodePudding user response:

You can use the following transformation equations:

r = √(x²   y²)
φ = arctan(y, x)   2kπ

where the function arctan is on four quadrants.

In the case of your Archimedean spiral, check that

(√(x²   y²) - arctan(y, x)) / 2π

is an integer.

  • Related