Updated this with some optimization tricks. Got the render time down from about 150 ms to under 100 on my machine. It’s actually to the point where you can do some relatively uncrappy animation with it. Click the image below to toggle anim:
[kml_flashembed movie=“https://www.bit-101.com/2003/wp-content/uploads/2008/03/polaranim.swf” width=“400″ height=“400″/]
I still wouldn’t consider it animation worthy. But I think it’s at least speedy enough to render with new values on the fly, like if you wanted to adjust params with sliders or something like my original demo. FYI, I tried removing the sqrt call in the loop, as suggested in the comments of the last post, but realized I still need the unsquared distance to calculate other values.
I also checked to make sure that neither dimension of the temp bitmap is over 2880, just in case someone wants to use a portrait mode image as source.
Furthermore, I changed the api a bit. The first version put the inner and outer radius and invert in the constructor. I realized that those made a lot more sense in the render method. So I put them there, along with the seam as another parameter. Now that they are in the render method, I removed them as setters on the object itself.
Next up, I’m going to look at something to handle the seam better, and maybe sky removal…