

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
Object common:Generic common:Formula common:ConvergentDivergentFormula
class
Convergent/Divergent Formula base class.
This class extends Formula to provide automatic, simple
bailout tests. Formulas for which the outside points
converge on points OR grow without bound should derive
from this class so as to avoid having to write the
bailout tests and the GetUpperBailout() and
GetLowerBailout() function.
class ConvergentDivergentFormula(Formula) { ; Convergent/Divergent Formula base class. ; <p> ; This class extends Formula to provide automatic, simple ; bailout tests. Formulas for which the outside points ; converge on points OR grow without bound should derive ; from this class so as to avoid having to write the ; bailout tests and the GetUpperBailout() and ; GetLowerBailout() function. public: ; Constructor ; ; @param pparent a reference to the object creating the new object; typically, 'this' func ConvergentDivergentFormula(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 m_ZOld = pz return pz endfunc ; Produce the next value in the sequence ; <p> ; As long as the sequence has not bailed out, this function ; will be continually called to produce sequence values. ; ; @param 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. ; @return the next value in the sequence complex func Iterate(complex pz) Formula.Iterate(pz) ; We need to update our previouslysaved Z value. m_ZOld = pz 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_upperbailout  pzm_ZOld < @p_lowerbailout endfunc ; Determine the upper bailout boundary. ; ; @return the upper bailout parameter float func GetUpperBailout() return @p_upperbailout endfunc ; Determine the lower bailout boundary. ; ; @return the lower bailout parameter float func GetLowerBailout() return @p_lowerbailout endfunc protected: complex m_ZOld default: int param v_convergentdivergentformula caption = "Version (ConvergentDivergentFormula)" 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_convergentdivergentformula < 100 endparam float param p_upperbailout 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 float param p_lowerbailout caption = "Bailout" default = 1.0e15 hint = "Defines how soon an orbit bails out, i.e. doesn't belong to the fractal set anymore. Note: smaller values result in more iterations being calculated." endparam }
Constructor Summary  

ConvergentDivergentFormula()


ConvergentDivergentFormula(Generic pparent)
Constructor 
Method Summary  

float 
GetLowerBailout()
Determine the lower bailout boundary. 
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. 
complex 
Iterate(complex pz)
Produce the next value in the sequence 
Methods inherited from class common:Formula 

GetPrimaryExponent 
Methods inherited from class common:Generic 

GetParent 
Methods inherited from class Object 


Constructor Detail 

public ConvergentDivergentFormula(Generic pparent)
pparent
 a reference to the object creating the new object; typically, 'this'public ConvergentDivergentFormula()
Method Detail 

public complex Init(complex pz)
This function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit).
Init
in class Formula
pz
 seed value for the sequence; for a normal fractal formula, this will be #pixel
public complex Iterate(complex pz)
As long as the sequence has not bailed out, this function will be continually called to produce sequence values.
Iterate
in class Formula
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.
public boolean IsBailedOut(complex pz)
Since this is a divergent fractal, the test is easy: if it's bigger than the bailout, the sequence is done.
IsBailedOut
in class Formula
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.
public float GetUpperBailout()
GetUpperBailout
in class Formula
public float GetLowerBailout()
GetLowerBailout
in class Formula


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 