mmf
Class MMF_SwitchMagnet1

Object
  extended by common:Generic
      extended by common:Formula
          extended by common:ConvergentDivergentFormula
              extended by mmf:MMF_SwitchConvergentDivergentFormula
                  extended by mmf:MMF_SwitchMagnet1

class 
MMF_SwitchConvergentDivergentFormula:MMF_SwitchMagnet1

Object version of Magnet 1 for switching
Object switch version by David Makin


Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_SwitchMagnet1(MMF_SwitchConvergentDivergentFormula) {
 ;
 ; Object version of Magnet 1 for switching<br>
 ;
 ; Object switch version by David Makin<br>
 ;
 public:
   import "common.ulb"
   ; @param pparent the parent, generally "this" for the parent, or zero
   func MMF_SwitchMagnet1(Generic pparent)
     MMF_SwitchConvergentDivergentFormula.MMF_SwitchConvergentDivergentFormula(pparent)
   endfunc
 
   complex func Iterate(complex pz)
     MMF_SwitchConvergentDivergentFormula.Iterate(pz)
     return sqr( (pz^2 + fConstant - 1) / (2*pz + fConstant - 2) )
   endfunc
 
   bool func IsBailedOut(complex pz)
     if ((@p_BailType=="Divergent" || @p_BailType=="Both") \
         && |pz|>@p_upperbailout) \
        || ((@p_BailType=="Convergent" || @p_BailType=="Both") \
            && ((!fType && |pz-m_ZOld|<@p_lowerbailout) \
                || (fType && |pz-1.0|<@p_lowerbailout)))
       m_BailedOut = true
     endif
     return m_BailedOut
   endfunc
 
   float func GetUpperBailout()
     return @p_upperbailout
   endfunc
 
   float func GetLowerBailout()
     return @p_lowerbailout
   endfunc
 
 default:
   title = "Switch Magnet 1"
   rating = recommended
   complex param p_power
     visible = false
   endparam
   complex param p_start
     caption = "Mandelbrot Start Value"
     default = (0,0)
     visible = @p_manual && @p_mandy
   endparam
   complex param p_seed
     caption = "Julia Seed"
     default = (0,0)
     visible = @p_manual && !@p_mandy
   endparam
   int param p_BailType
     caption = "Bailout Type"
     enum = "Divergent" "Convergent" "Both"
     default = 2
   endparam
   float param p_lowerbailout
     caption = "Convergent Bailout"
     default = 1e-14
     exponential = true
     hint = "Convergent bailout value; smaller values will cause more \
             iterations to be done for each point."
     visible = @p_BailType>0
   endparam
   float param p_upperbailout
     caption = "Divergent Bailout"
     default = 1e20
     exponential = true
     hint = "Divergent bailout value; it's best to use large values to \
             avoid erroneous detection of divergent bailout in convergent \
             areas."
     visible = @p_BailType!=1
   endparam
 }
 


Constructor Summary
MMF_SwitchMagnet1()
           
MMF_SwitchMagnet1(Generic pparent)
           
 
Method Summary
 float GetLowerBailout()
          Determine the lower bailout boundary.
 float GetUpperBailout()
          Determine the upper bailout boundary.
 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 mmf:MMF_SwitchConvergentDivergentFormula
Init, SetParams
 
Methods inherited from class common:Formula
GetPrimaryExponent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_SwitchMagnet1

public MMF_SwitchMagnet1(Generic pparent)
Parameters:
pparent - the parent, generally "this" for the parent, or zero

MMF_SwitchMagnet1

public MMF_SwitchMagnet1()
Method Detail

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)

GetUpperBailout

public float GetUpperBailout()
Description copied from class: ConvergentDivergentFormula
Determine the upper bailout boundary.

Overrides:
GetUpperBailout in class ConvergentDivergentFormula
Returns:
the upper bailout parameter

GetLowerBailout

public float GetLowerBailout()
Description copied from class: ConvergentDivergentFormula
Determine the lower bailout boundary.

Overrides:
GetLowerBailout in class ConvergentDivergentFormula
Returns:
the lower bailout parameter