Math-Fractal-Mandelbrot

 view release on metacpan or  search on metacpan

Mandelbrot.xs  view on Meta::CPAN

      iter = _point (x1,y);
      av_push( a2, newSViv(iter) );
      }
    av_push( a2, newSViv(same) );
    RETVAL = a2;
  OUTPUT:
    RETVAL


##############################################################################
# set_max_iter() - set maximum iterations
# input: new max_iter

unsigned int
set_max_iter(myclass, new_max_iter)
	unsigned int	new_max_iter
  CODE:
    m_max_iter = new_max_iter;
    if (new_max_iter == 0) { m_max_iter = 1; }		/* at least 1 */
    RETVAL = m_max_iter;
  OUTPUT:

lib/Math/Fractal/Mandelbrot.pm  view on Meta::CPAN


X<license>
X<perl>

=head1 METHODS

=head2 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.

=head2 set_limit()

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

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

=head2 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.

=head2 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);

=head2 point()

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

Calculates the value at the point C<$x> and C<$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 C<w> and 0 and C<h>, respectively (see
L<set_bounds()>).

=head2 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.



( run in 1.011 second using v1.01-cache-2.11-cpan-71847e10f99 )