Giter Site home page Giter Site logo

josecelano / c-mandelbrot-arbitrary-precision Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 3.0 4.41 MB

Proof of concept project about adding arbitrary precision math to Fractal generation software GNofract4D.

CMake 0.89% Dockerfile 0.25% C 72.65% C++ 25.78% Shell 0.29% Python 0.15%
c mandelbrot mandelbrot-fractal arbitrary-precision c-language

c-mandelbrot-arbitrary-precision's Introduction

About Me

Since 23/03/2023

I'm a senior developer with a focus on backend development. My expertise used to be PHP, although I'm also starting to enjoy doing things with TypeScript and I'm now working full-time with Rust. I live in Gran Canaria (Spain) and work remotely.

Career highlights

Things I am interested in

Articles

Tech Guides

Social networks

c-mandelbrot-arbitrary-precision's People

Contributors

josebailo avatar josecelano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

c-mandelbrot-arbitrary-precision's Issues

Improve periodicity checking

If you enable "periodicity checking" the application will try to find periods in the fractal loop. The pre-defined periods for the Mandelbrot Set are:

image

But if you execute the application you will get something like:

image

The period detection is worse near to the fractal border and and when you zoom in.

That's because there are 3 parameters that are fixed in the algorithm that should be calculated dynamically. These parameters are:

  1. Minimum number of iterations before detecting cycles.

  2. Period tolerance.

  3. Maximum number of iterations.

  4. Minimum number of iterations

Param: https://github.com/josecelano/c-mandelbrot-arbitrary-precision/blob/master/src/mandelbrot/domain/optimisation/periodicity_checking.c#L59

The more you are closer to the border the more chaos you will have before the orbit gets stable. For example, this is the orbit for a period 1 next to the main cardioid center:

image

And this is the orbit for a point closer to the border where the application is not detecting the rigth cycle:

image

As you can see the orbit get stable after the first 60 iterations and the hard coded value is 20.

  1. Period tolerance

Param: https://github.com/josecelano/c-mandelbrot-arbitrary-precision/blob/master/src/mandelbrot/domain/optimisation/periodicity_checking.c#L88

In this image:

image

you can see a point in the main main circle (period-2) close to the border. You can see the cycle but the peaks are not exactly the same value, you can see there is a difference and the cycle length is not well detected. In this case the problem is we need to adjust the period tolerance. It should be greater.

  1. Maximum number of iterations

Param: https://github.com/josecelano/c-mandelbrot-arbitrary-precision/blob/master/src/mandelbrot/domain/optimisation/periodicity_checking.c#L92

This is a point in the main cardioid next to the border.

image

You can see that tends to a fix value but it takes more iterations than a point closer to the center like:

image

In order to detect the right cycle length, the application should start detecting the cycle later and increase the number of iterations.

And finally if you want to try different point you can use this site I built to find out how to calculate these 3 parameters dynamically.

https://mandelbrot-set-periods.online/

You can also take a look at this program: https://github.com/fract4d/gnofract4d or any other fractal generation software to find out how to calculate the right values for those parameters.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.