Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Calculate points in the Julia set
branch: master
Failed to load latest commit information.
examples Style change
lib/Math/Fractal Tiny pod change
t Changed some tests
.gitignore Don't ignore that test.
Changes Changed some tests
INSTALL Add license and install files
Julia.xs Refactor XS
LICENSE Add license and install files
README Update readme
dist.ini dzil config update
ppport.h Upgrade ppport.h
typemap Add comments

README

NAME
    Math::Fractal::Julia - Calculate points in the Julia set

VERSION
    version 0.000003

SYNOPSIS
        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(
            max_iter => $iters,
            limit    => $limit,
            bounds   => [ $x1, $x2, $y1, $y2, $width, $height ],
            constant => [ $cx, $cy ],
        );
        for my $y ( 0 .. $h - 1 ) {
            for my $x ( 0 .. $w - 1 ) {
                my $iter = $julia->point( $x, $y );
            }
        }

DESCRIPTION
    Calculates points in the set named after the French mathematician Gaston
    Julia.

    The procedural interface is based on that provided by
    Math::Fractal::Mandelbrot.

METHODS
  new
    Arguments: %options?
    Return value: A Math::Fractal::Julia object

    Creates a new Math::Fractal::Object. If no options are provided, the
    default values will be used.

    options
        The "options" hash may contain any or all of the following:

        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_max_iter
    Arguments: $max
    Return value: undefined

    Set the maximum number of iterations. The default value is 600.

        Math::Fractal::Julia->set_max_iter($max);

        $julia->set_max_iter($max);

  set_limit
    Arguments: $limit
    Return value: undefined

    The default value is 5.

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

        $julia->set_limit($limit);

  set_bounds
    Arguments: $x1, $y1, $x2, $y2, $width, $height
    Return value: undefined

    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.

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

  set_constant
    Arguments: $cx, $cy
    Return value: undefined

    The default values are (0.0, 0.0).

        Math::Fractal::Julia->set_constant( $cx, $cy );

        $julia->set_constant( $cx, $cy );

  point
    Arguments: $x, $y
    Return value: The number of iterations needed to exceed the limit or 0
    if the the limit is not exceeded.

    This function translates the coordinates using the bounds and then
    iterates.

        $iters = Math::Fractal::Julia->point( $x, $y );

        $iters = $julia->point( $x, $y );

CAVEATS
    *   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.

SEE ALSO
    *   Math::Fractal::Mandelbrot

    *   Julia set <http://en.wikipedia.org/wiki/Julia_set>

AUTHOR
    Jeffrey T. Palmer <jtpalmer@cpan.org>

COPYRIGHT AND LICENSE
    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.

Something went wrong with that request. Please try again.