|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:Formula
common:ConvergentDivergentFormula
mmf:MMF_FormulaTransformWrapper
class
A formula that wraps two transforms around any formula iteration.
Note that for historical reasons this formula uses its own
zold and bailout values instead of those defined in the base class
doing so should not be taken as a model for other formulas.
class MMF_FormulaTransformWrapper(common.ulb:ConvergentDivergentFormula) {
; A formula that wraps two transforms around any formula iteration.<p>
; Note that for historical reasons this formula uses its own
; zold and bailout values instead of those defined in the base class
; doing so should not be taken as a model for other formulas.<br>
public:
import "common.ulb"
import "Standard.ulb"
; @param pparent the parent, generally "this" for the parent, or zero
func MMF_FormulaTransformWrapper(Generic pparent)
ConvergentDivergentFormula.ConvergentDivergentFormula(pparent)
fFormula = new @classFormula(this)
fPreTransform = new @classPreTransform(this)
fPostTransform = new @classPostTransform(this)
endfunc
complex func Init(complex pz)
; m_Iterations = 0 not used in this formula
m_BailedOut = false
fPreTransform.Init(pz)
fPostTransform.Init(pz)
return fFormula.Init(pz)
endfunc
complex func Iterate(complex pz)
fZold = pz
; m_Iterations = m_Iterations + 1 not used in this formula
return fPostTransform.Iterate(fFormula.Iterate(fPreTransform.Iterate(pz)))
endfunc
complex func GetPrimaryExponent()
return fFormula.GetPrimaryExponent()
endfunc
bool func IsBailedOut(complex pz)
if ((@p_BailType=="Divergent" || @p_BailType=="Both" \
|| @p_BailType=="Div.+Abs.Conv.") \
&& |pz|>=@p_Bailout) \
|| ((@p_BailType=="Convergent" || @p_BailType=="Both") \
&& |pz-fZold|<=@p_SmallBail) \
|| ((@p_BailType=="Absolute Convergence" \
|| @p_BailType=="Div.+Abs.Conv.") \
&& |pz-@p_root|<=@p_SmallBail )
m_BailedOut = true
endif
return m_BailedOut
endfunc
float func GetUpperBailout()
return @p_Bailout
endfunc
float func GetLowerBailout()
return @p_SmallBail
endfunc
protected:
Formula fFormula
UserTransform fPreTransform
UserTransform fPostTransform
complex fZold
default:
title = "Formula Transformations"
int param v_mmfformulatransformwrapper
caption = "Version (MMF_FormulaTransformWrapper)"
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_mmfformulatransformwrapper < 100
endparam
complex param p_power
visible = false
endparam
float param p_upperbailout
visible = false
endparam
float param p_lowerbailout
visible = false
endparam
heading
caption = "Bailout Options"
text = "You should note that the bailout options and values you set \
here will override the bailout settings in the 'Formula' \
parameters. This is because your chosen transforms may cause \
a divergent formula to become convergent or vice-versa."
endheading
int param p_BailType
caption = "Bailout Type"
enum = "Divergent" "Convergent" "Both" "Absolute Convergence" \
"Div.+Abs.Conv."
default = 0
hint = "If you get an empty or nearly empty fractal try switching \
from 'Divergent' to 'Convergent' or vice-versa or choosing \
'Both'. Note that in some cases if your fractal is a \
Mandelbrot you may need to ensure that the zstart value \
is non-zero."
endparam
complex param p_root
caption = "Convergence Value"
default = (1,0)
hint = "This is the value for testing for convergence to. For the \
'Magnet' formulas the value should be (1,0), if you don't \
know the value to use it's best to stick to the plain \
'Convergent' 'Bailout Type'. It's always worth trying (0,0)."
visible = @p_BailType>2
endparam
float param p_Bailout
caption = "Divergent Bailout"
default = 128.0
hint = "In general larger values will require higher iterations."
visible = @p_BailType==0 || @p_BailType==2 || @p_BailType==4
endparam
float param p_SmallBail
caption = "Convergent Bailout"
default = 1e-5
hint = "In general smaller values will require higher iterations."
visible = @p_BailType>0
endparam
heading
caption = "The Pre-Transform"
text = "Transforms z on each iteration prior to the main formula \
calculation."
endheading
UserTransform param classPreTransform
caption = "Pre-Transform"
default = NullTransform
hint = "Transforms z on each iteration prior to the main formula \
calculation."
endparam
heading
caption = "The Main Formula"
endheading
Formula param classFormula
caption = "Formula"
default = Standard_Mandelbrot
hint = "The main formula."
endparam
heading
caption = "The Post-Transform"
text = "Transforms z on each iteration after the main formula \
calculation."
endheading
UserTransform param classPostTransform
caption = "Post-Transform"
default = NullTransform
hint = "Transforms z on each iteration after the main formula \
calculation."
endparam
}
| Constructor Summary | |
|---|---|
MMF_FormulaTransformWrapper()
|
|
MMF_FormulaTransformWrapper(Generic pparent)
|
|
| Method Summary | |
|---|---|
float |
GetLowerBailout()
Determine the lower bailout boundary. |
complex |
GetPrimaryExponent()
Determine the primary exponent. |
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:Generic |
|---|
GetParent |
| Methods inherited from class Object |
|---|
|
| Constructor Detail |
|---|
public MMF_FormulaTransformWrapper(Generic pparent)
pparent - the parent, generally "this" for the parent, or zeropublic MMF_FormulaTransformWrapper()
| Method Detail |
|---|
public complex Init(complex pz)
ConvergentDivergentFormulaThis function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit).
Init in class ConvergentDivergentFormulapz - seed value for the sequence; for a normal fractal formula, this will be #pixel
public complex Iterate(complex pz)
ConvergentDivergentFormulaAs long as the sequence has not bailed out, this function will be continually called to produce sequence values.
Iterate in class ConvergentDivergentFormulapz - 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 complex GetPrimaryExponent()
FormulaMany fractals can be characterized by an exponent value that is useful to other formulas, so we provide that here. If your formula does not need or use this value, override the p_power parameter and make it hidden.
GetPrimaryExponent in class Formulapublic boolean IsBailedOut(complex pz)
ConvergentDivergentFormulaSince this is a divergent fractal, the test is easy: if it's bigger than the bailout, the sequence is done.
IsBailedOut in class ConvergentDivergentFormulapz - 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()
ConvergentDivergentFormula
GetUpperBailout in class ConvergentDivergentFormulapublic float GetLowerBailout()
ConvergentDivergentFormula
GetLowerBailout in class ConvergentDivergentFormula
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||