common Class ConvergentFormula

Object common:Generic common:Formula common:ConvergentFormula
Direct Known Subclasses:
ConvergentManyJulia, MMF_SwitchConvergentFormula, MT_BofNewtonI, MT_BofNewtonII, MT_BofNewtonIIJulia, MT_BofNewtonIJulia, MT_JewelNewton, MT_JewelNewtonJulia, REB_CayleyJulia, REB_CayleyMandel, REB_Newton, Standard_Newton, Standard_NovaJulia, Standard_NovaMandel

class
Formula:ConvergentFormula

Convergent Formula base class.

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

Ultra Fractal Source
class ConvergentFormula(Formula) {
; Convergent Formula base class.
; <p>
; This class extends Formula to provide automatic, simple
; bailout tests. Formulas for which the outside points
; converge on points should derive from this class
; so as to avoid having to write the bailout tests and
; the GetLowerBailout() function.

public:
; Constructor
;
; @param pparent a reference to the object creating the new object; typically, 'this'
func ConvergentFormula(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 previously-saved 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-m_ZOld| < @p_bailout
endfunc

; Determine the lower bailout boundary.
;
; @return the lower bailout parameter
float func GetLowerBailout()
return @p_bailout
endfunc

protected:
complex m_ZOld

default:
int param v_convergentformula
caption = "Version (ConvergentFormula)"
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_convergentformula < 100
endparam

float param p_bailout
caption = "Bailout"
default = 1.0e-15
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
ConvergentFormula()

ConvergentFormula(Generic pparent)
Constructor

Method Summary
float GetLowerBailout()
Determine the lower 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, GetUpperBailout

Methods inherited from class common:Generic
GetParent

Methods inherited from class Object

Constructor Detail

ConvergentFormula

public ConvergentFormula(Generic pparent)
Constructor

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

ConvergentFormula

public ConvergentFormula()
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

Iterate

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

GetLowerBailout

public float GetLowerBailout()
Determine the lower bailout boundary.

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