mmf
Class MMF_SwitchPhoenix

Object
  extended by common:Generic
      extended by common:Formula
          extended by common:DivergentFormula
              extended by mmf:MMF_SwitchDivergentFormula
                  extended by mmf:MMF_SwitchPhoenix

class 
MMF_SwitchDivergentFormula:MMF_SwitchPhoenix

Switchable object version of the Phoenix.
The general equation is of the form
z(n+1) = z(n)^a + c*z(n)^b + p*z(n-1)
Originators: Damien M. Jones, Shigehiro Ushiki


Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_SwitchPhoenix(MMF_SwitchDivergentFormula) {
 ;
 ; Switchable object version of the Phoenix.<br>
 ; The general equation is of the form<br>
 ;
 ;     z(n+1) = z(n)^a + c*z(n)^b + p*z(n-1)<br>
 ;
 ; Originators: Damien M. Jones, Shigehiro Ushiki<br>
 ;
 public:
   import "common.ulb"
 
   ; @param pparent the parent, generally "this" for the parent, or zero
   func MMF_SwitchPhoenix(Generic pparent)
     MMF_SwitchDivergentFormula.MMF_SwitchDivergentFormula(pparent)
   endfunc
   
   complex func Init(complex pz)
     fOld = (0, 0)
     return MMF_SwitchDivergentFormula.Init(pz)
   endfunc
 
   complex func Iterate(complex pz)
     complex newz
     if !@p_advanced || @p_switch=="Normal"
       newz = pz^@p_power + pz^@power2 * fConstant + @induct * fOld
     elseif @p_switch=="Exponent 1"
       newz = pz^fConstant + pz^@power2 * @p_seed1 + @induct * fOld
     elseif @p_switch=="Exponent 2"
       newz = pz^@p_power + pz^fConstant * @p_seed1 + @induct * fOld
     else;if @p_switch=="Distortion"
       newz = pz^@p_power + pz^@power2 * @p_seed1 + fConstant * fOld
     endif
     fOld = pz
     return newz
   endfunc
 
 private:
   complex fOld
 
 default:
   title = "Switch Phoenix"
   rating = recommended
   bool param p_addpixel
     caption = "Offset z start"
     default = false
     hint = "When enabled the z start value (in Mandelbrot mode) is offset \
             by the constant for the current position - normally '#pixel'. \
             When your z start value is (0,0) then enable this for the \
             original functionality of the Phoenix formula i.e. so that \
             non-zero values of 'Exponent 2' will produce a Mandelbrot \
             although it should be noted that leaving this disabled and \
             using a Mandelbrot Start value of say 1e-5 may give a \
             better Mandelbrot guide to the available Julia Sets."
     visible = !@p_manual || @p_mandy
   endparam
   bool param p_advanced
     caption = "Enable Advanced Settings"
     default = false
     hint = "When enabled you can choose which variable is switchable."
   endparam
   int param p_switch
     caption = "Switch Value"
     enum = "Normal" "Exponent 1" "Exponent 2" "Distortion"
     default = 3
     hint = "In 'Normal' mode the additive constant is the switchable \
             variable, in the other modes the relevant values are made \
             switchable instead."
     visible = @p_advanced
   endparam
   complex param p_seed1
     caption = "Seed"
     default = (-1,0)
     hint = "The constant c in z(n)^a + c*z(n)^b + p*z(n-1)."
     visible = @p_advanced && @p_switch>0
   endparam
   complex param p_power ; Overrides p_power from Formula
     caption = "Exponent 1"
     default = (2,0)
     hint = "Defines the primary exponent for the fractal. The classic \
             Phoenix curve uses exponent (2, 0)."
     visible = !@p_advanced || @p_switch!=1
   endparam
   complex param power2
     caption = "Exponent 2"
     default = (0,0)
     hint = "Defines the secondary exponent for the fractal.  The classic \
             Phoenix curve uses exponent (0, 0)."
     visible = !@p_advanced || @p_switch!=2
   endparam
   complex param induct
     caption = "Distortion"
     default = (0.5,0)
     hint = "Sets how 'strong' the previous iteration's effect should be \
             on the fractal."
     visible = !@p_advanced || @p_switch!=3
   endparam
   float param p_bailout ; Overrides p_bailout from DivergentFormula
     caption = "Bailout"
     default = 1.0e20
     exponential = true
     hint = "This parameter defines how soon an orbit bails out while \
             iterating. Larger values will give smoother outlines."
   endparam
 }
 


Constructor Summary
MMF_SwitchPhoenix()
           
MMF_SwitchPhoenix(Generic pparent)
           
 
Method Summary
 complex Init(complex pz)
          Set up for a sequence of values
 complex Iterate(complex pz)
          Produce the next value in the sequence
 
Methods inherited from class mmf:MMF_SwitchDivergentFormula
SetParams
 
Methods inherited from class common:DivergentFormula
GetUpperBailout, IsBailedOut
 
Methods inherited from class common:Formula
GetLowerBailout, GetPrimaryExponent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_SwitchPhoenix

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

MMF_SwitchPhoenix

public MMF_SwitchPhoenix()
Method Detail

Init

public complex Init(complex pz)
Description copied from class: DivergentFormula
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 MMF_SwitchDivergentFormula
Parameters:
pz - the initial location
Returns:
initial z for iteration

Iterate

public complex Iterate(complex pz)
Description copied from class: Formula
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 Formula
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