reb
Class Switch

Object
  extended by common:Generic
      extended by common:Formula
          extended by reb:Switch
Direct Known Subclasses:
REB_3RDIMFrameRobert_Switch, REB_3RDIMIkenaga_Switch, REB_3RDIMMagnet1_Switch, REB_3RDIMMagnet2_Switch, REB_3RDIMMandelbrot_Switch, REB_3RDIMManowar_Switch, REB_3RDIMSpider_Switch, REB_Cayley_Switch, REB_CubicRoots_Switch, REB_FrameRobert_Switch, REB_FrameRobertRoots_Switch, REB_FunBarnsley1_Switch, REB_FunBarnsley2_Switch, REB_Gopalsamy_Switch, REB_Gopalsamy3_Switch, REB_Gopalsamy5_Switch, REB_Ikenaga_Switch, REB_IkenagaRoots_Switch, REB_Magnet1_Switch, REB_Magnet2_Switch, REB_MandelbrotJulia_Switch, REB_Manowar_Switch, REB_NegativeMandelPower_Switch, REB_Newton_Switch, REB_OldPhoenix_Switch, REB_Phoenix_Switch, REB_SJFrameRobert_Switch, REB_SJIkenaga_Switch, REB_SJMagnet1_Switch, REB_SJMagnet2_Switch, REB_SJMandelbrot_Switch, REB_SJManowar_Switch, REB_SJSpider_Switch, REB_Spider_Switch, REB_Switch_Embossed, REB_Switch_FractalTiler, REB_Switch_Slope, REB_TentMap_Switch

class 
Formula:Switch



Ultra Fractal Source

Toggle UF Source Code Display

 class Switch(common.ulb:Formula) {
   
 public:
   import "common.ulb"
   ; Constructor
   ;
   func Switch(Generic pparent)
     Formula.Formula(pparent)
   endfunc
   
   complex func Init(complex pz)
     Formula.Init(pz)
     m_BailedOut = false
     m_zold = pz
     return pz
   endfunc
   
   complex func Iterate(complex pz)
     Formula.Iterate(pz)
     m_zold = pz
     return pz
   endfunc
 
 
   bool func IsBailedOut(complex pz)
     return  |pz| > @p_upperbailout || |pz-m_zold| < @p_lowerbailout
   endfunc
 
   func SetParams(bool mand, bool jul, complex c)
     m_mand = mand
     m_jul = jul
     m_c = c
   endfunc
 
   func GetParams(bool &mand, bool &jul, complex &c)
     mand = m_mand
     jul = m_jul
     c = m_c
   endfunc
 
 
 protected:
   complex m_zold
   float m_bailout
   float m_bailout2
   complex m_power
   int m_test
   complex m_c  
   bool m_mand
   bool m_jul
   
 default:
   int param v_switchformula
     caption = "Version (Switch Formula)"
     default = 100
     hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
     visible = @v_switchformula < 100
   endparam
 
   float param p_upperbailout
     caption = "Bailout (Divergent)"
     default = 1.0e10
   endparam
   float param p_lowerbailout
     caption = "Bailout (Convergent)"
     default = 1e-10
   endparam
 }
 


Constructor Summary
Switch()
           
Switch(Generic pparent)
          Constructor
 
Method Summary
 void GetParams(boolean mand, boolean jul, complex c)
           
 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
 void SetParams(boolean mand, boolean jul, complex c)
           
 
Methods inherited from class common:Formula
GetLowerBailout, GetPrimaryExponent, GetUpperBailout
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

Switch

public Switch(Generic pparent)
Constructor


Switch

public Switch()
Method Detail

Init

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

IsBailedOut

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

This is typically called once per iteration to test whether the sequence has completed. If producing this result is difficult to do separately from the Iterate() processing, you should produce the result in Iterate() and set the m_BailedOut flag appropriately, and leave IsBailedOut() unimplemented in your class to inherit this behavior.

Note that this test is the OPPOSITE sense of the bailout: section in UF's fractal formulas. A bailout: section returns TRUE to continue iterating. IsBailedOut() must return FALSE to continue iterating.

Overrides:
IsBailedOut in class Formula
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)

SetParams

public void SetParams(boolean mand,
                      boolean jul,
                      complex c)

GetParams

public void GetParams(boolean mand,
                      boolean jul,
                      complex c)