an engine for generating fractals, implemented in scala, utilizing actors, traits and mixins
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scripts
src
.gitignore
LICENSE
NOTES
README
TODO
build.sbt
makefile

README

                          fractactor README


General Information

  fractactor is a fractal generating engine implemented in scala. It uses
  actors and asynchronous messaging to achieve a high degree of 
  parallelism and traits to layer in compute functions and rendering 
  strategies.

  The purpose of this project is to utilize some of the key features of
  the scala programming language to build an elegant, highly parallel, 
  and modular solution for calculating functions, such as the Mandelbrot set,
  in the complex plane.

  This project isn't the fastest Mandelbrot set generator ever written.
  And, it certainly isn't the most feature rich. 

  It does, however, attempt to take advantage of some of scala's interesting 
  features:

    0. Overloaded operators - complex operations, e.g. Complex: z = z*z + c
    1. Pattern matching - e.g. FractalGenerator, renderer/function selection
    2. Actors - parallelism and asynchronous messaging, e.g. FractalPeer
    3. Traits - rendering and calculation, e.g. HolomorphicFunction, Renderer
    4. Mixins - compound composition, e.g. FractalGenerator


Usage

  % scripts/fractactor.sh

  Scala actor-based fractal engine.

  Usage: FractalGenerator type render mode iter w h rmin imin rmax imax [file]

  e.g. To generate the Mandelbrot set, using 1 actor per pixel, to a file:
    FractalGenerator mandelbrot file pixels 256 512 512 -1.5 -1.5 1.5 1.5 x.jpg

  e.g. To generate the Mandelbrot set, w/ 1 actor per scanline, to the screen:
    FractalGenerator mandelbrot screen pixels 256 512 512 -1.5 -1.5 1.5 1.5
  

Design/Flow

        user
               \  .main
               |
    ^          v
    |    +-----------+                     [0]            
    |    | Generator | . . . . . . . . . . . . . . . . . . . . . . . . 
    |    +-----------+                                               .
    |     [1]  | .do                     MandelbrotFunction          .
    |          V                                 |                   .
    |     -----------     PixelRequest     ------------     .start   .
    |    | Assembler | -----------------> | Calculator | < . . . . . .
    |     -----------         [2]          ------------              .
    |                                            |                   .
    | [5]                                    [3] | PixelResponse     .
    |                                            V                   .
    |     -----------         [4]           -----------              .
     \__ | Renderer  | <------------------ |    Peer   | < . . . . . .
          -----------      .set(x, y)       -----------     .start


Classes

  Calculation
    HolomorphicFunction [trait] - a generic function in the complex plane
      MandelbrotFunction [trait] - the Mandelbrot function

  Rendering
    Renderer [trait] - an interface for rendering pixels
      ScreenRenderer - Renderer, with a screen implementation
      FileRenderer - Renderer, with a JPG file implementation
    RenderPanel - Java/Swing panel w/ support for plotting pixels or scanlines

  Fractal Generation
    Settings - general system settings
    ImageAssembler - converts cartesian screen points into calculation requests
    FractalCalculator - (actor) receives & responds to calculation requests
    FractalPeer - (actor) receives results and dispatches them to the renderer

  Console/UI Application
    FractalGenerator - generator composed from assembler/calculator/peer

  Tests
    MandelbrotClient - console to test point calculation and messaging