|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object common:Generic common:Formula reb:Switch
class
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 |
---|
public Switch(Generic pparent)
public Switch()
Method Detail |
---|
public complex Init(complex pz)
Formula
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)
Formula
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)
Formula
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.
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 void SetParams(boolean mand, boolean jul, complex c)
public void GetParams(boolean mand, boolean jul, complex c)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |