Skip to content

phillip-h/fractal-gen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fractal-gen

A C++ program to generate Mandelbrot and Julia set fractals

about

fractal-gen is a simple program that will output a PNG image of the fractal specified in the program's arguments. The user can set the size, scale, colors, color depth, and translation of the generated image, along with the fractal parameters themselves.

lodepng is used for PNG output.

The example fractal was generated with:

./fractal-gen 512 512 3.5 99D9FF FF6666 171717 mandelbrot 64

usage

Clone the repository and run make to build.

Running the program will produce a PNG file called fractal.png of the program output. Warning -- the program will happily overwrite any existing fractal.png file. You might want to rename or move fractals that you intend on keeping.

syntax

fractal-gen <width> <height> <scale> [color A] [color B] [color C]
                                     [cr+ci] [color depth] [offx] [offy]

arguments

<width> -> the integral width of the output image

<height> -> the integral height of the output image

<scale> -> a floating-point scale for the output image. The scale can be thought of as how zoomed the fractal is, a smaller scale means a higher zoom.

[color A] -> the first color, provided in #RRGGBB format. The # may be ommited. This color is used as the first point in a linear interpolation, it will be used as values depart the bounds of the fractal. Defaults to #000000

[color B] -> the second color, provided in #RRGGBB format. The # may be ommited. This color is used as the second point in a linear interpolation, it will be used as values approach the bounds of the fractal. Defaults to #FFFFFF

[color C] -> the third color, provided in #RRGGBB format. The # may be ommited. This color is used for points determined to be within the fractal. For non-mandelbrot fractals, it may be wise to set it to the same value as color B. Defaults to #000000

[cr+ci] -> The complex argument used in fractal generation. This is what can be used to change the generated fractal. Should be given in the for of real_part + imaginary_part, or mandelbrot for the mandelbrot set. Defaults to mandelbrot.

[color depth] -> the color depth used in coloring. A higher value will be more accurate, but may fade the image. A lower value will make the fractal "pop", but causes distortion that detracts from the image accuracy. Experiment to find the ideal balance for each fractal.

[off x] -> an integral argument for an X translation to be done on the generated image. defaults to 0.5.

[off y] -> an integral argument for a Y translation to be done on the generatedf image. Defaults to 0.0.

known bugs

  • non-square images don't always work

About

A C++ fractal generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages