common
Class DivergentFormula

Object
  extended by common:Generic
      extended by common:Formula
          extended by common:DivergentFormula
Direct Known Subclasses:
ckDivergentManyJulia, DivergentManyJulia, DMJ_Simurgh, fn_z, fn_z_plus_fn_pixel, Manowar, Manowar_Julia, MMF_SwitchDivergentFormula, MT_Alternate, MT_BarnsleyI, MT_BarnsleyIJulia, MT_Boost, MT_Celtic, MT_CelticJulia, MT_Druid, MT_DruidJulia, MT_PopcornJulia, MT_Traps, REB_3RDIMFrame_Robert, REB_3RDIMFrame_RobertJulia, REB_3RDIMIkenaga, REB_3RDIMIkenagaJulia, REB_3RDIMManowar, REB_3RDIMManowarJulia, REB_3RDIMSpider, REB_3RDIMSpiderJulia, REB_FrameRobert, REB_FrameRobertJulia, REB_FunBarnsley1, REB_FunBarnsleyJulia1, REB_Gopalsamy, REB_Gopalsamy3, REB_Gopalsamy5, REB_IkenagaJulia, REB_IkenagaMap, REB_Julia, REB_Mandelbrot, REB_MandelGopalsamy, REB_MandelGopalsamy3, REB_MandelGopalsamy5, REB_OldPhoenix, REB_OldPhoenixMandelbrot, REB_TentMap, REB_TentMapJulia, Standard_Julia, Standard_LambdaJulia, Standard_LambdaMandelbrot, Standard_Mandelbrot, Standard_PhoenixJulia, Standard_PhoenixMandel

class 
Formula:DivergentFormula

Divergent Formula base class.

This class extends Formula to provide automatic, simple bailout tests. Formulas for which the outside points become arbitrarily large should derive from this class so as to avoid having to write the bailout tests and the GetUpperBailout() function.


Ultra Fractal Source

Toggle UF Source Code Display

 class DivergentFormula(Formula) {
   ; Divergent Formula base class.
   ; <p>
   ; This class extends Formula to provide automatic, simple
   ; bailout tests. Formulas for which the outside points
   ; become arbitrarily large should derive from this class
   ; so as to avoid having to write the bailout tests and
   ; the GetUpperBailout() function.
   
 public:
   ; Constructor
   ;
   ; @param pparent a reference to the object creating the new object; typically, 'this'
   func DivergentFormula(Generic pparent)
     Formula.Formula(pparent)
   endfunc
   
   ; Set up for a sequence of values
   ; <p>
   ; This function will be called at the beginning of each
   ; sequence of values (e.g. at the beginning of each fractal
   ; orbit).
   ;
   ; @param pz seed value for the sequence; for a normal fractal formula, this will be #pixel
   ; @return first value in the sequence; this corresponds to #z in a fractal formula
   complex func Init(complex pz)
     Formula.Init(pz)
     ; Base class implementation flags the sequence to end
     ; immediately. We clear the flag here.
     m_BailedOut = false
     return pz
   endfunc
   
   ; Test whether the formula has bailed out (i.e. the sequence is complete)
   ; <p>
   ; Since this is a divergent fractal, the test is easy: if it's
   ; bigger than the bailout, the sequence is done.
   ;
   ; @param 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.
   ; @return true if the sequence has bailed out (i.e. should be terminated)
   bool func IsBailedOut(complex pz)
     return |pz| > @p_bailout
   endfunc
 
   ; Determine the upper bailout boundary.
   ;
   ; @return the upper bailout parameter
   float func GetUpperBailout()
     return @p_bailout
   endfunc
   
 default:
   int param v_divergentformula
     caption = "Version (DivergentFormula)"
     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_divergentformula < 100
   endparam
 
   float param p_bailout
     caption = "Bailout"
     default = 1.0e20
     hint = "Defines how soon an orbit bails out, i.e. doesn't belong to the fractal set anymore. Note: larger values result in more iterations being calculated."
   endparam
 }
 


Constructor Summary
DivergentFormula()
           
DivergentFormula(Generic pparent)
          Constructor
 
Method Summary
 float GetUpperBailout()
          Determine the upper bailout boundary.
 complex Init(complex pz)
          Set up for a sequence of values
 boolean IsBailedOut(complex pz)
          Test whether the formula has bailed out (i.e.
 
Methods inherited from class common:Formula
GetLowerBailout, GetPrimaryExponent, Iterate
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DivergentFormula

public DivergentFormula(Generic pparent)
Constructor

Parameters:
pparent - a reference to the object creating the new object; typically, 'this'

DivergentFormula

public DivergentFormula()
Method Detail

Init

public complex Init(complex pz)
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

IsBailedOut

public boolean IsBailedOut(complex pz)
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 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)

GetUpperBailout

public float GetUpperBailout()
Determine the upper bailout boundary.

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