Jump to my Home Page Send me a message Check out stuff on GitHub Check out my photography on Instagram Check out my profile on LinkedIn Check out my profile on reddit Check me out on Facebook

Mitch Richling: Tippets

Author: Mitch Richling
Updated: 2022-12-10

wavy_25.png

Table of Contents

1. Introduction

The Tippets Fractal is a a Mandelbrot'alike in that its generating function is a minor modification of the one used for the Mandelbrot Set.

2. Algorithm & Code

#include "ramCanvas.hpp"

double ranges[6][4] = { {  -2.700,  2.100, -2.100,  2.100 },
                        {  -2.100, -1.700, -0.300,  0.300 },
                        {  -1.540, -1.330, -0.175,  0.175 },
                        {   0.250,  0.700, -1.000,  1.000 },
                        {   0.250,  0.600,  0.700,  1.000 },
                        {  -0.720, -0.695,  0.385,  0.410 } };

typedef mjr::ramCanvas3c8b::colorType ct;
typedef ct::csIntType                 cit;

int main(void) {
  std::chrono::time_point<std::chrono::system_clock> startTime = std::chrono::system_clock::now();
  const int NUMITR = 2000;
  const int CSIZE  = 3840;

  int count;
  mjr::ramCanvas3c8b::coordFltType a, b, zx, zy;
  mjr::ramCanvas3c8b theRamCanvas(CSIZE, CSIZE);
  for(int i=0; i<6; i++) {
    theRamCanvas.newRealCoords(ranges[i][0], ranges[i][1], ranges[i][2], ranges[i][3]);
    theRamCanvas.clrCanvasToBlack();
    for(int y=0;y<theRamCanvas.getNumPixY();y++) {
      if((y%(CSIZE/10))==0)
        std::cout << "    CASE: " << i << " LINE: " << y << "/" << CSIZE << std::endl;
      for(int x=0;x<theRamCanvas.getNumPixX();x++) {
        for(a=theRamCanvas.int2realX(x),b=theRamCanvas.int2realY(y),zx=zy=0.0,count=0;
            (zx*zx+zy*zy<100000)&&(count<=NUMITR);
            count++,zx=zx*zx-zy*zy+a,zy=2*zx*zy+b) ;
        if(count < NUMITR)
          theRamCanvas.drawPoint(x, y, ct::csCColdeFireRamp::c(mjr::numberWrap(static_cast<cit>(count*20), 767)));
      }
    }
    theRamCanvas.writeTIFFfile("tippets" + std::to_string(i) + ".tiff");
  }
  std::chrono::duration<double> runTime = std::chrono::system_clock::now() - startTime;
  std::cout << "Total Runtime " << runTime.count() << " sec" << std::endl;
}

The above program will generate all of the images in the gallery below.

4. References

Check out the fractals section of my reading list.

All the code used to generate everything on this page may be found on github.