假设对于当前的复数值C,算法在Z被证明大于2时逃脱了n次迭代。
我编写了以下颜色部分的程序:
if(n==maxIterations){
color=0.0; //0.0 is black in OpenGL when put to each channel of RGB
//Points in M-brot set are colored black.
} else {
color = (n + 1 - log(log(abs(Z)))/log(2.0) )/maxIterations;
//continuous coloring algorithm, color is between 0.0 and 1.0
//Points outside M-brot set are colored depending of their absolute value,
//from brightest near the edge of set to darkest far away from set.
}
glColor3f(color ,color ,color );
//OpenGL-command for making RGB-color from three channel values.
问题是,这并不起作用。一些平滑处理是可以注意到的,但并不完美。
但是当我添加两个额外的迭代时(在某个地方找到这个方法而没有解释)
Z=Z*Z+C;
n++;
在计算颜色之前的“else”分支中,图片变得非常平滑和优美。
为什么会这样呢?为什么我们需要在检查点是否位于集合中之后,在着色部分添加额外的迭代次数?