Skip to content

LasterAlex/fracform-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fracform Core

This is the core library for fractal generation, named after FRACtal FORMing (cuz fracgen sounds boring) (or it may have been FRACtal FORMula, cuz it can use any formula to make the fractal, tbh idk, it was a long time ago, maybe even FORMing of FRACtals)

The goal is to make a library that can very efficiently generate

  1. Fractals adjacent to the Mandelbrot set (Mandelbrot set, Julia set, Buddhabrot, Antibuddhabrot, etc)
  2. Non-boring other fractals (Newton's fractal, etc)
  3. Animations of any of these fractals

I have adored fractals for a very long time, and this is the first actually good and performant attempt


How to use

Creation of the regular fractal:

  1. Go to main.rs and go down to fn run()
  2. Tweak the parameters to your liking
  3. Ensure that run is spawned by child in the fn main()
  4. cargo run --release
  5. You will find your fractal at ./generated/fractals

Creation of animations:

  1. Go to main.rs and go down to fn make_animation()
  2. Tweak the parameters to your liking (factor:.2 in the formula is a linear function, starting from start_factor, and ending on end_factor)
  3. Ensure that make_animation is spawned by child in the fn main()
  4. cargo run --release
  5. You will find your animation frames at ./generated/animations/this_changes_for_every_formula, you can delete them if you want
  6. You will find your animation mp4 at ./generated/animations

config.rs:

MAX_PIXELS - the max amount of pixels that can be generated (needs to be known at compile time) JOBS - the jobs created to generate fractals. In general, if the fractal is small and fast - 1 job is better, cuz spawning jobs costs time, but if it's a big and complicated fractal that takes seconds to make, tweaking JOBS will improve the speed STACK_SIZE - the size of the stack. The bigger it is, the bigger MAX_PIXELS can get, but also slower startup times spent on allocating that stack *_DIR - The name of the directories, NOT PATH! The path structure is set in code for consistency WRITE_TO_BITMAP_LEN_THRESHOLD - The threshold for writing to a vector in the buddhabrot code. The lower it is, the slower it is, but the higher it is, the more heap gets used.


Notes:

  1. The first compilation of the project will be slower than the rest, because it will build formula_project in the project directory to allow for dynamic formulas

  2. Palettes are not yet very refined, but i very much plan on changing it! These are the current ones:

Rainbow palette:

rainbow palette

Smooth palette:

smooth palette

Brown and blue palette:

brown and blue palette

Naive palette (shift = 300):

naive palette with shift 300


Todo list:

  • Add mandelbrot and julia generation
  • Parallelize the code
  • Add different colorings
  • Animation generation
  • Add buddhabrot and antibuddhabrot
  • Add nebulabrot and antinebulabrot
  • Make the GOOD coloring to all of fractals
  • Add a smart way of memorizing every fractal (save every parameter to recreate the fractal)
  • Make some form of CLI
  • Convert it to an actual library, instead of a regular project

About

Core of fractal forming

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages