POV-Ray : Newsgroups : povray.binaries.images : Here's TIA : Here's TIA Server Time
19 Apr 2024 07:54:34 EDT (-0400)
  Here's TIA  
From: Melody
Date: 10 Jan 2020 21:50:01
Message: <web.5e193327d41def9da690110@news.povray.org>
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'
save000.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.