Class: Fractals::Mandelbrot

Inherits:
Fractal show all
Defined in:
lib/fractals.rb

Overview

Benoît Mandelbrot’s Mandelbrot set fractal.

Instance Attribute Summary

Attributes inherited from Fractal

#args, #c, #expression

Attributes inherited from Renderers::Base

#algorithm, #bailout, #height, #last_iteration, #magnification, #max_iterations, #set_color, #theme, #width

Instance Method Summary collapse

Methods inherited from Fractal

#iterate

Methods inherited from Renderers::Base

acts_as_renderer, #in_set?, #render, #renderer=, #where_is?

Constructor Details

#initialize(c = Complex(-0.65, 0.0)) ⇒ Mandelbrot

Returns a new instance of Mandelbrot.



83
84
85
86
87
# File 'lib/fractals.rb', line 83

def initialize(c=Complex(-0.65, 0.0))
  super(c, {:z => 0, :p => 2})  do |args|
                                  args[:z] = args[:z]**args[:p] + args[:c]
                                end
end