|
|
Do you want to read a long winded thesis - or hear the lecture???
NO. you want to see 10 lines of code and grok it in 2 minutes.
There was color midpoint stuff that changed nothing for a smooth palette, but
all palette stuff aside, here is "Triangle Inequality"
Eleven significant lines ... TIA
int mandel(double px, double py) {
int ra,col, mandelbrotPower = 2; ///double bailout = pow(10,3);
double bailout_squared = bailout * bailout;
double sum=0,sum2=0,ac,il,lp,az2,lowbound,f,index;
double z[2] = { 0.0,0.0 } ;
double c[2] = { px,py } ;
double v[2] = { 0,0 } ;
/// Triangle Inequality
ac = VLEN2(c);
il = 1.0 / log(mandelbrotPower);
lp = log(log(bailout) / mandelbrotPower);
int i = 0;
double x = 0.0, y = 0.0, xx = 0.0, yy = 0.0;
while ((i < MAX_iters) && (xx + yy < bailout_squared)) {
if (ABORT) break;
y = 2.0 * x * y + py;
x = xx - yy + px;
xx = x * x;
yy = y * y;
z[0] = x;
z[1] = y;
sum2=sum;
if ((i) && (i != MAX_iters-1)) {
SUBV2(v,z,c);
az2 = VLEN2(v);
lowbound = fabs(az2 - ac);
sum+=((VLEN2(z)-lowbound)/(az2+ac-lowbound));
}
i++;
}
if (i == MAX_iters) col = 0;
else {
///TIA log(log(length)) log(pwr) log(log(bailout/pwr))
/// figured in with last 2 sums- "Triangle"
sum = sum / (float)i;
sum2 = sum2/(float)(i-1);
f = il*lp - il*log(log(VLEN2(z)));
index = sum2 + ((sum-sum2) * (f+1.0));
/// rest is just palette stuff
ra = (int)(index * 255.0);
if (ra < 0) ra += 255;
ra = (ra + (int)(nColors * colorcycle) ) % nColors;
col = colorpalette[ra];
}
return col;
}
fractal height fields? hmmm ...
Post a reply to this message
Attachments:
Download 'save000.jpg' (826 KB)
Preview of image 'save000.jpg'
|
|
|
|
Finished the color spreader stuck at 45, now 3 to 100.
between 2 to 64 colors
That control factor, like contrast, pulls out detail,
where the colorcycle will put the like/dark where you want it.
Post a reply to this message
Attachments:
Download 'save000.jpg' (849 KB)
Preview of image 'save000.jpg'
|
|
|
|
I'll need a better job, to get the machine I need, heh.
bailout is a million times a million, or 10^12.
"10^20 recommended" -- but I saw results at 10^3 that were posted.
Details!
Post a reply to this message
Attachments:
Download 'mandel.png' (314 KB)
Preview of image 'mandel.png'
|
|