Math::Fractal::Julia - Calculate points in the Julia set
version 0.000003
use Math::Fractal::Julia; # Procedural usage: Math::Fractal::Julia->set_max_iter($iters); Math::Fractal::Julia->set_limit($limit); Math::Fractal::Julia->set_bounds( $x1, $y1, $x2, $y2, $w, $h ); Math::Fractal::Julia->set_constant( $cx, $cy ); for my $y ( 0 .. $h - 1 ) { for my $x ( 0 .. $w - 1 ) { my $iter = Math::Fractal::Julia->point( $x, $y ); } } # Object Oriented usage: my $julia = Math::Fractal::Julia->new(%options); $julia->set_max_iter($iters); $julia->set_limit($limit); $julia->set_bounds( $x1, $y1, $x2, $y2, $w, $h ); $julia->set_constant( $cx, $cy ); for my $y ( 0 .. $h - 1 ) { for my $x ( 0 .. $w - 1 ) { my $iter = $julia->point( $x, $y ); } }
Calculates points in the set named after the French mathematician Gaston Julia.
The procedural interface is based on that provided by Math::Fractal::Mandelbrot.
Creates a new Math::Fractal::Object. If no options are provided, the default values will be used.
The options hash may contain any or all of the following:
options
max_iter => $iters
limit => $limit
bounds => [ $x1, $x2, $y1, $y2, $width, $height ]
constant => [ $cx, $cy ]
The default maximum number of iterations is 600. The default limit is 5. The default bounds is [-2.2, -1.1, 1.0, 1.1, 640, 480]. The default constant is [0.0, 0.0].
my $julia = Math::Fractal::Julia->new(); my $julia = Math::Fractal::Julia->new(%options); my $julia = Math::Fractal::Julia->new( max_iter => $iters, limit => $limit, bounds => [ $x1, $x2, $y1, $y2, $width, $height ], constant => [ $cx, $cy ], );
Set the maximum number of iterations. The default value is 600.
Math::Fractal::Julia->set_max_iter($max); $julia->set_max_iter($max);
The default value is 5.
Math::Fractal::Julia->set_limit($limit); $julia->set_limit($limit);
Set the bounds of the set. The first four values ($x1, $y1, $x2, $y2) define a rectangle. The remaining two ($width, $height) define a viewport.
$x1
$y1
$x2
$y2
$width
$height
The default values are (-2.2, -1.1, 1.0, 1.1, 640, 480).
Math::Fractal::Julia->set_bounds( $x1, $y1, $x2, $y2, $width, $height ); $julia->set_bounds( $x1, $x2, $y1, $y2, $width, $height );
The default values are (0.0, 0.0).
Math::Fractal::Julia->set_constant( $cx, $cy ); $julia->set_constant( $cx, $cy );
This function translates the coordinates using the bounds and then iterates.
$iters = Math::Fractal::Julia->point( $x, $y ); $iters = $julia->point( $x, $y );
This module is not thread-safe.
Any packages derived from Math::Fractal::Julia will share the same internal state when the procedural interface is used.
Math::Fractal::Julia
Math::Fractal::Mandelbrot
Julia set
Jeffrey T. Palmer <jtpalmer@cpan.org>
This software is copyright (c) 2012 by Jeffrey T. Palmer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Math::Fractal::Julia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Fractal::Julia
CPAN shell
perl -MCPAN -e shell install Math::Fractal::Julia
For more information on module installation, please visit the detailed CPAN module installation guide.