AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: polarCoords

polarCoords(S) applies the transformation

x = r⋅sin(φ)
y = r⋅cos(φ)

to all two-dimensional polar real vectors (r, φ) in the set S, and returns the new set of Cartesian coordinates (x, y).

This is useful for plotting polar graphs. Simply create a set S of polar coordinates (r, φ) and then transform it using

S ≔ polarCoords(S)

after which it can be plotted using drawSet, drawLines, etc.

Example: A cardioid
         cardioid ≔ createImage("❨4⋅(cos(φ) + 1), φ❩", "φ", [0, 2⋅π, 0.001])
         cardioid ≔ polarCoords(cardioid)
         drawSet("cardioid")