Math::Fractal::Mandelbrot - Calculate points in the mandelbrot fractal


Math-Fractal-Mandelbrot documentation Contained in the Math-Fractal-Mandelbrot distribution.

Index


Code Index:

NAME

Top

Math::Fractal::Mandelbrot - Calculate points in the mandelbrot fractal

SYNOPSIS

Top

DESCRIPTION

Top

Calculates points, horizontal/vertical stripes or rectangular areas of the famous Mandelbrot fractal.

fractal mandelbrot recursive

LICENSE

Top

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

license perl

METHODS

Top

set_max_iter()

	Math::Fractal::Mandelbrot->set_max_iter($max_iter);

Set the maximum number of iterations. 600 is the default and quite suitable for the start image. When zooming in, this value should be increased to not loose details.

set_limit()

	Math::Fractal::Mandelbrot->set_limit($limit);

The default value is 5 and should only be changed if you know why.

set_epsilon()

	Math::Fractal::Mandelbrot->set_epsilon($e);

The default value is 0.001. When the change between two iterations is less than this number, the point is considered to be on the inside.

set_bounds()

	Math::Fractal::Mandelbrot->set_bounds($x1,$y1,$x2,$y2,$w,$h);

Set the coordinates from x1, y1 to x2, y2 and the width of the computed image to w and h.

The default values are:

	Math::Fractal::Mandelbrot->set_bounds(-2,-1.1, 1,1.1, 640,480);

point()

	my $iter = Math::Fractal::Mandelbrot->point($x,$y);

Calculates the value at the point $x and $y. The return value 0 means the point is inside the fractal (typical the black area), any value >0 means the number of iterations it took to find out that the point is on the outside.

$x and $y should be between 0 and w and 0 and h, respectively (see set_bounds()).

hor_line($x1,$y1,$l)

	my $points = Math::Fractal::Mandelbrot->hor_line($x1,$y1,$l);

Calculates the values at a horizontal line and returns them all as a ref to am array.

The array will contain one extra value, which is the count of values in the array beeing equal to the first value. Example:



	values		count	explanation
	==============================================================
	1,1,1,1,3,	4 	# 4 are equal
	1,1,3,1,3,	2	# only 2, not 3 since it stops after 2

See point() for details.

ver_line($x1,$y1,$l)

	my @points = Math::Fractal::Mandelbrot->ver_line($x1,$y1,$l);

Calculates the values at a vertical line and returns them all as array. The array will contain one extra value, which is the count of values in the array beeing equal to the first value. See hor_line for an explanation of this last value.

See point() for further details.

AUTHOR

Top

Tels <http://bloodgate.com/> in 2003, 2005, 2006.

tels

SEE ALSO

Top

Math::Fractal::DLA by Wolfgang Gruber.


Math-Fractal-Mandelbrot documentation Contained in the Math-Fractal-Mandelbrot distribution.

###############################################################################
# calculate points/stripes in the mandelbrot fractal efficient

package Math::Fractal::Mandelbrot;

use 5.005;
use strict;
# use warnings; # dont use warnings for older Perls

require Exporter;
require DynaLoader;

use vars qw/@ISA $VERSION @EXPORT_OK/;
@ISA = qw(Exporter DynaLoader);

@EXPORT_OK = qw/
   point hor_line ver_line
   set_bounds set_limit set_max_iter set_epsilon
   /;

$VERSION = '0.04';

bootstrap Math::Fractal::Mandelbrot $VERSION;

# no Perl code, it's all in the XS code

1;
__END__