Here I'm going on the original paper:
http://flam3.com/flame.pdfThe flam3 source code is far less clear than I'd like (and appears to implement a lot of tricks not specified in the paper) and Kandid and Apophysis both use it.
The normal algorithm for solving for S is called the chaos game. In pseudocode it is:
(x, y)= a random point in the bi-unit square
iterate { i = a random integer from 0 to n − 1 inclusive
(x, y) = F_i(x, y)
plot(x, y) except during the first 20 iterations
}
Does fractal flame rendition really require you to iterate the transform 20 or so times before you plot the point? With a standard IFS you don't need to do that.
The bi-unit square are those points where x and y are both in [-1,1].
Do I need to make sure points fall within the bi-unit square? I wouldn't think so.
We now generalize this algorithm. The first step is to use a larger class of functions than just affine functions. Start by composing a non-linear function V_j from R^2 to R^2 with the affine functions ...
The non-linear functions are given in the back of the paper. What are some good ways to get affine functions for inside V_j short of evolution?
Would these do e.g.?
http://ecademy.agnesscott.edu/~lriddle/ifskit/gallery/gallery.htmAre post and final transforms necessary to get decent looking flames? Furthermore the pseudocode for final transforms is unclear.
(x, y)= a random point in the bi-unit square
iterate { i = a random integer from 0 to n − 1 inclusive
(x, y) = Fi(x, y)
(x_f , y_f) = F_final(x, y)
plot(x_f , y_f) except during the first 20 iterations
}
So, the paper tells me that the final transform is not "in the loop" (apparently meaning that it comes after all the 20 or whatever iterations) but in the pseudocode it seems otherwise.
Regarding colors. We'll assume I want an RGB image. So, assuming I'm reading the paper right, Pythonic code for increment would be like:
pixel['red'] = (c_i + pixel['red']) / 2
pixel['green'] = (c_i + pixel['green']) / 2
pixel['blue'] = (c_i + pixel['blue']) / 2
pixel['alpha'] += 1
Then, when all iterations are done, and I'm ready to plot the image, for each pixel, I do:
pixel['red'] = pixel['red'] * math.log(pixel['alpha']) / pixel['alpha']
pixel['green'] = pixel['green'] * math.log(pixel['alpha']) / pixel['alpha']
pixel['blue'] = pixel['blue'] * math.log(pixel['alpha']) / pixel['alpha']
...and then do a linear scale of these values from [0,1] to [0,255], like here e.g. (will be required for both the python prototype I plan on writing and the OCaml final which will output PPM files)
pixel['red'] = int(255 * pixel['red'])
The thing is, do I also scale alpha? If so, before or after the color channels?
TIA