Math::Fractal::DLA - Diffusion Limited Aggregation (DLA) Generator
use Math::Fractal::DLA; $fractal = new Math::Fractal::DLA; # Dynamic loading of the subclass Math::Fractal::DLA::TYPE $fractal->setType( TYPE ); # Open the log file FILE $fractal->debug( debug => 1, logfile => FILE ); # Add a message to the log file $fractal->addLogMessage( MESSAGE ); # Global settings $fractal->setSize(width => 200, height => 200); $fractal->setPoints(5000); $fractal->setFile( FILENAME ); # Color settings $fractal->setBackground(r => 255, g => 255, b => 255); $fractal->setColors(5); $fractal->setBaseColor(base_r => 10, base_g => 100, base_b => 100, add_r => 50, add_g => 0, add_b => 0); # Write the generated fractal to a file $fractal->writeFile(); # Or return it $fractal->getFractal();
Math::Fractal::DLA is a Diffusion Limited Aggregation (DLA) fractal generator
The Diffusion Limited Aggregation (DLA) fractal belongs to the group of stochastic fractals.
It was invented by the two physicists T.A. Witten and L.M. Sander in 1981. The fractal is created by single particles which move randomly towards an target area. By hitting the area the particle becomes a part of it and the fractal grows.
Math::Fractal::DLA is just the framework for subclasses like Math::Fractal::DLA::Explode and doesn't implement any methods for fractal generation. To generate a fractal, you have to create a Math::Fractal::DLA object and load the subclass by calling the method setType. Otherwise you have to use an object from a subclass directly without calling the method setType. For the specific methods of the subclasses, take a look at their perldoc.
This is the constructor for Math::Fractal::DLA
No parameters are required
Activates the debug mode
The debug information will be appended to FILENAME
Adds MESSAGE to the log file
Loads an existing image in JPG- or PNG-format and uses it as background image
Sets the size of the image
Sets the number of points that will be used for the fractal
Sets the output file. Supported file formats are JPG and PNG
Writes the fractal to the file specified by the method setFile
Returns the fractal
All colors are specified with their RGB-values which range from 0 to 255.
Sets the background color for the image.
Sets the number of colors which will be used.
Starting with the base color, defined by base_r, base_g, base_b, the values of add_r, add_g and add_b will be added after each interval (number of points / colors). The values of add_r, add_g and add_b may be less than zero.
You want to use 5 colors in your fractal with a base color of base_r => 10, base_g => 100, base_b => 100 and the add values of add_r => 50, add_g => 0, add_b => 0:
$fractal->setColors(5); $fractal->setBaseColor(base_r => 10, base_g => 100, base_b => 100, add_r => 50, add_g => 0, add_b => 0);
As result the following colors will be used to draw the fractal:
(r,g,b): (10,100,100), (60,100,100), (110,100,100), (160,100,100), (210,100,100)
Wolfgang Gruber, firstname.lastname@example.org
Lincoln D. Stein's GD module
Copyright (c) 2002 by Wolfgang Gruber. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.