Skip to main content

Liven up your app with fractal flames

Posted by kirillcool on June 21, 2006 at 4:20 PM PDT

The latest addition to one of the Substance plugins (watermark pack) provides a playground to experiment with fractal-based artwork. Much like the noise-based watermarks, you can play with the API to create your own (and sometimes stunningly beautiful) watermarks.

The code is loosely based on the ideas from the flam3 site (see this PDF for some math). Feel free to explore some of the code right here. Here are some examples of the fractal flame watermarks along with the source code (the parameters are highly random chosen to create some interesting images. The first parameter is the degree of symmetry).

The first image is that of kaleidoscope and is obtained by the following code (note the degree of symmetry is 4):

public class Kaleidoscope extends IteratedFunctionSystem {
   public Kaleidoscope() {
      super(4, new Functions.SphericalFunction(0.365654, 0.18286, 0.23786324,
            0.234234, -0.4123234, 0.312123),
            new Functions.ExFunction(0.234234, 0.987234, 0.23786324,
                  0.5345456, -0.98456465, 0.312123),
            new Functions.SphericalFunction(0.88745, -0.8934734, -0.546312,
                  0.7896, -0.445899, 0.132468));
   }
}




The second one is vortex and is obtained by the following code (no symmetry added):

public class Vortex extends IteratedFunctionSystem {
   public Vortex() {
      super(1, new Functions.HorseShoeFunction(-0.654897, 0.16886, -0.32645,
            0.0598, 0.952376, -0.231534),
            new Functions.HorseShoeFunction(0.31378, 0.451321, -0.234235,
                  -0.321534, -0.12436, -0.761234));
   }
}




The third one is singularity and is obtained by the following code (degree of symmetry 2):

package org.jvnet.substance.watermarkpack.flamefractal;
public class Singularity extends IteratedFunctionSystem {
   public Singularity() {
      super(2, new Functions.SphericalFunction(0.365654, 0.987234, 0.23786324,
            0.234234, -0.4123234, 0.312123),
            new Functions.SphericalFunction(0.67656, 0.8934734, -0.546312,
                  -0.7896, -0.65487, 0.132468));
   }
}




The last one is scriptures (my favourite - just trace all the repetitive nested marks) and is obtained by the following code (no symmetry added):

public class Scriptures extends IteratedFunctionSystem {
   public Scriptures() {
      super(1, new Functions.HorseShoeFunction(-0.654897, 0.16886, -0.32645,
            0.0598, 0.452376, -0.231534),
            new Functions.HorseShoeFunction(0.31378, 0.451321, -0.234235,
                  -0.321534, -0.12436, -0.761234));
   }
}




Related Topics >>