Seems to work quite well.
Perhaps the following can be used instead of map...
- float x = (1-q/TWO_PI)*input.width;
Also, your code seems close to the first example, but the second (output-based) and third (LUTs) were actually more efficient. However I always like to say, whatever works. For only a few or static images this is fine, for series or realtime processing, you can move calculations to look-up tables (see the blog post's third example) or use GLSL shaders (which by now have been integrated quite well into Processing 2.0).