Fractals with Java

Hello everybody!

Today I created a new program in Java to create self similar sets. This are a type of fractals generated by rotations, translations and shrinking. However pictures are worth thousands of words. Let me to give some examples!

Frac4
Spirals
Frac3
Likes leaves
Pythagoras tree
Pythagoras tree
Frac2
Rains

The slider on the left are used to create your fractal on the right. Here the meaning of any sliders:

  • S indicates in how many way we want to repeat our fractals. For example for the Pythagoras tree we use two ways.
  • Times indicates how many times we want to repeat our pictures.

The user needs to be careful on using the “Times” slider because the number of points will increase exponentially.
In general, by using a little of math, we know that we have (S+1)^Times squares, so 4(S+1)^Times points. For example, for S = 2, Times = 10, our picture will represents 3^10 little squares.

  • For any function S we need to assign a rotation in degrees (with “Grade”), a shrinking in percentage (with “Size”) and a translation (in x with “X axis” and in y with “Y axis”).
    For example if we have Grade=45, Size=75, X axis=100, Y axis=-50, it means that we rotate our square of 45°, our new picture will be 75% the original one, and it will moved on the right of 100 pixels and on the bottom of 50 pixels.

You can download this small Java programs from here: Link v1.0 (9 KB) (old version with black fractals)

Link v1.1 (10 KB)
+ Added at the bottom a save button to save your fractals in .png files
+ Now the fractals are in red
+ Correct small mistakes

Note: To open a jar file in Windows, you must have the Java Runtime Environment installed.

Best,
Stefano Martin

Share This:

3 thoughts on “Fractals with Java”

Leave a Reply

Your email address will not be published. Required fields are marked *