Standard
Class Standard_Magnet2Mandelbrot

Object
  extended by common:Generic
      extended by common:Formula
          extended by common:ConvergentDivergentFormula
              extended by Standard:Standard_Magnet2Mandelbrot

class 
ConvergentDivergentFormula:Standard_Magnet2Mandelbrot

Object version of Magnet2Mandelbrot in Standard.ufm. Magnetic Mandelbrot set type 2.


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_Magnet2Mandelbrot(common.ulb:ConvergentDivergentFormula) {
 ;
 ; Object version of Magnet2Mandelbrot in Standard.ufm.
 ; Magnetic Mandelbrot set type 2.
 ;
 public:
   complex func Init(complex pz)
     fPixel = pz
     return @p1
   endfunc
 
   complex func Iterate(complex pz)
     return sqr( (pz^3 + 3 * (fPixel-1) * pz + (fPixel-1) * (fPixel-2))  /     \
            (3 * pz^2 + 3 * (fPixel-2) * pz + (fPixel-1) * (fPixel-2) + 1) )
   endfunc
 
   bool func IsBailedOut(complex pz)
     return |pz| >= @p_upperbailout || |pz - 1| <= @p_lowerbailout
   endfunc
   
 private:
   complex fPixel
 
 default:
   title = "Magnet 2 (Mandelbrot)"
   helpfile = "Uf*.chm"
   helptopic = "Html/formulas/standard/magnet.html"
   param p1
     caption = "Perturbation"
     default = (0, 0)
     hint = "Starting value for each point. You can use this to \
             'perturb' the fractal. Use (0, 0) for the classic set."
   endparam
   param p_upperbailout ; Overrides p_upperbailout from ConvergentDivergentFormula
     caption = "Bailout value"
     default = 100.0
     min = 1
     exponential = true
     hint = "This parameter defines how soon an orbit bails out while \
             iterating. Larger values give smoother outlines; smaller values \
             generally produce more interesting shapes around the set."
   endparam
   param p_lowerbailout ; Overrides p_lowerbailout from ConvergentDivergentFormula
     caption = "Convergent bailout value"
     default = 0.00005
     min = 0
     exponential = true
     hint = "This parameter defines how soon a convergent orbit bails out while \
             iterating. Smaller values give more precise results but usually \
             require more iterations."
   endparam
   complex param p_power ; Hide p_power from Formula
     visible = false
   endparam
 }
 


Constructor Summary
Standard_Magnet2Mandelbrot()
           
 
Method Summary
 complex Init(complex pz)
          Set up for a sequence of values
 boolean IsBailedOut(complex pz)
          Test whether the formula has bailed out (i.e.
 complex Iterate(complex pz)
          Produce the next value in the sequence
 
Methods inherited from class common:ConvergentDivergentFormula
GetLowerBailout, GetUpperBailout
 
Methods inherited from class common:Formula
GetPrimaryExponent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

Standard_Magnet2Mandelbrot

public Standard_Magnet2Mandelbrot()
Method Detail

Init

public complex Init(complex pz)
Description copied from class: ConvergentDivergentFormula
Set up for a sequence of values

This function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit).

Overrides:
Init in class ConvergentDivergentFormula
Parameters:
pz - seed value for the sequence; for a normal fractal formula, this will be #pixel
Returns:
first value in the sequence; this corresponds to #z in a fractal formula

Iterate

public complex Iterate(complex pz)
Description copied from class: ConvergentDivergentFormula
Produce the next value in the sequence

As long as the sequence has not bailed out, this function will be continually called to produce sequence values.

Overrides:
Iterate in class ConvergentDivergentFormula
Parameters:
pz - previous value in the sequence; corresponds to #z in a fractal formula. Note that you should always use this value for computing the next iteration, rather than a saved value, as the calling code may modify the returned value before passing it back to the next Iterate() call.
Returns:
the next value in the sequence

IsBailedOut

public boolean IsBailedOut(complex pz)
Description copied from class: ConvergentDivergentFormula
Test whether the formula has bailed out (i.e. the sequence is complete)

Since this is a divergent fractal, the test is easy: if it's bigger than the bailout, the sequence is done.

Overrides:
IsBailedOut in class ConvergentDivergentFormula
Parameters:
pz - last sequence value to test; this should be the value returned from the previous Iterate() call. Note that it is acceptable to ignore pz and use m_BailedOut, but any code calling IsBailedOut() should pass in the correct pz for Formula classes which do not use m_BailedOut.
Returns:
true if the sequence has bailed out (i.e. should be terminated)