In addition to the familiar cartesian coordinate system, MathMap provides the polar coordinate system. Each pixel has two polar coordinates, namely r and a. The following illustration helps in understanding the polar coordinate system:
The value of r is simply the distance from the origin (i.e. the center of the image) to that pixel.
The value of a is the angle between the positive x-axis and the line from the origin to the point in question.
However, the angle is not measured in degrees (0-360), but in radians, which range from 0 to 2*pi. This may seem a bit awkward, but it is more convenient mathematically. However, MathMap provides two functions to convert between radians and degrees, namely rad2deg and deg2rad.
Polar coordinates make it very easy to generate pond-like effects. When we try the wavy expression from above and use polar instead of cartesian coordinates, leaving the a coordinate unchanged and shifting the r coordinate, we get the following expression:
origValRA(r+10*sin(r*(2*pi)/60),a)
which generates this image:
Next topic: Conditionals