|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object common:Generic common:Formula common:DivergentFormula mt:MT_Traps
class
Mark Townsend, June 2008
class MT_Traps(common.ulb:DivergentFormula) { ; ; Mark Townsend, June 2008 ; public: import "Standard.ulb" func MT_Traps(Generic pparent) fFormula = new @formulaClass(this) fTrapShape = new @TrapShapeClass(this) endfunc complex func Init(complex pz) complex start = fFormula.Init(pz) fTrapShape.Init(pz) return start endfunc complex func Iterate(complex pz) z = fFormula.Iterate(pz) fDis = fTrapShape.Iterate(z) return z endfunc bool func IsBailedOut(complex pz) if fFormula.IsBailedOut(pz) || fDis < @p_threshold m_BailedOut = True else m_BailedOut = false endif return m_BailedOut endfunc private: Formula fFormula TrapShape fTrapShape float fDis default: title = "Traps" float param p_threshold caption = "Threshold" default = 0.025 min = 1E-10 endparam Formula param formulaClass caption = "Fractal Formula" default = Standard_Mandelbrot endparam TrapShape param TrapShapeClass caption = "Trap Shape" default = Standard_TrapShapeCross endparam param p_power visible = false endparam float param p_bailout visible = false endparam }
Constructor Summary | |
---|---|
MT_Traps()
|
|
MT_Traps(Generic pparent)
|
Method Summary | |
---|---|
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:DivergentFormula |
---|
GetUpperBailout |
Methods inherited from class common:Formula |
---|
GetLowerBailout, GetPrimaryExponent |
Methods inherited from class common:Generic |
---|
GetParent |
Methods inherited from class Object |
---|
|
Constructor Detail |
---|
public MT_Traps(Generic pparent)
public MT_Traps()
Method Detail |
---|
public complex Init(complex pz)
DivergentFormula
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 DivergentFormula
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)
DivergentFormula
Since this is a divergent fractal, the test is easy: if it's bigger than the bailout, the sequence is done.
IsBailedOut
in class DivergentFormula
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |