dmj5
Class DMJ_FormulaGenerators
Object
common:Generic
common:Formula
dmj5:DMJ_FormulaGenerators
class
- Formula:DMJ_FormulaGenerators
Produce a sequence of complex numbers using two Generator classes. By default, Random Generators are used.
Ultra Fractal Source
Toggle UF Source Code Display
class DMJ_FormulaGenerators(common.ulb:Formula) {
; Produce a sequence of complex numbers using two Generator classes. By default, Random Generators are used.
public:
import "common.ulb"
func DMJ_FormulaGenerators(Generic pparent)
Formula.Formula(pparent)
m_Generator1 = new @f_generator1(this)
m_Generator2 = new @f_generator2(this)
m_Transfer1 = new @f_transfer1(this)
m_Transfer2 = new @f_transfer2(this)
endfunc
complex func Init(complex pz)
Formula.Init(pz)
; base class sets this flag to stop immediately; clear it
m_BailedOut = false
if (@p_ignorepixel)
m_Sequence1 = m_Generator1.InitDefault()
m_Sequence2 = m_Generator2.InitDefault()
else
m_Sequence1 = m_Generator1.Init(real(pz))
m_Sequence2 = m_Generator2.Init(imag(pz))
endif
complex c = m_Sequence1 + flip(m_Sequence2)
if (@p_defaulttransfer)
c = c*2 - (1,1)
else
m_Transfer1.Init(pz)
m_Transfer2.Init(pz)
c = m_Transfer1.Iterate(real(c)) + flip(m_Transfer2.Iterate(imag(c)))
endif
c = c*@p_scale + @p_center
return c
endfunc
complex func Iterate(complex pz)
Formula.Iterate(pz)
m_Sequence1 = m_Generator1.Iterate(m_Sequence1)
m_Sequence2 = m_Generator2.Iterate(m_Sequence2)
complex c = m_Sequence1 + flip(m_Sequence2)
if (@p_defaulttransfer)
c = c*2 - (1,1)
else
m_Transfer1.Init(pz)
m_Transfer2.Init(pz)
c = m_Transfer1.Iterate(real(c)) + flip(m_Transfer2.Iterate(imag(c)))
endif
c = c*@p_scale + @p_center
return c
endfunc
protected:
Generator m_Generator1
Generator m_Generator2
Transfer m_Transfer1
Transfer m_Transfer2
float m_Sequence1
float m_Sequence2
default:
title = "Dual Generators (Random Default)"
int param v_dmj_formulagenerators
caption = "Version (DMJ_FormulaGenerators)"
default = 101
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_dmj_formulagenerators < 100
endparam
complex param p_power
visible = false
endparam
Generator param f_generator1
caption = "Real Generator"
default = DMJ_GeneratorRandom
hint = "Sets the Generator to use to produce the real component of each value."
endparam
Generator param f_generator2
caption = "Imaginary Generator"
default = DMJ_GeneratorRandom2
hint = "Sets the Generator to use to produce the imaginary component of each value."
endparam
bool param p_ignorepixel
caption = "Ignore start value"
default = true
hint = "If checked, the Generators will be started with their default values regardless of the starting value that would normally apply (per pixel). This is useful in situations where the Formula is being used to generate the same sequence of values for every pixel."
endparam
bool param p_defaulttransfer
caption = "Use default range"
default = true
hint = "If checked, the default range of [-1,1] will be used for each component Generator. Otherwise, you will be able to select your own Transfer objects."
endparam
Transfer param f_transfer1
caption = "Real Transfer"
default = NullTransfer
hint = "Allows you to use a Transfer object to manipulate the output of the real component Generator."
visible = (@p_defaulttransfer == false)
endparam
Transfer param f_transfer2
caption = "Imaginary Transfer"
default = NullTransfer
hint = "Allows you to use a Transfer object to manipulate the output of the imaginary component Generator."
visible = (@p_defaulttransfer == false)
endparam
float param p_scale
caption = "Overall Scale"
default = 2/#magn
hint = "Allows you to scale the output of the Generators quickly. If the default range is used, this value will become the maximum and its negative will become the minimum."
endparam
complex param p_center
caption = "Overall Center"
default = #center
hint = "Allows you to move the output of the Generators quickly."
endparam
}
Methods inherited from class Object |
|
DMJ_FormulaGenerators
public DMJ_FormulaGenerators(Generic pparent)
DMJ_FormulaGenerators
public DMJ_FormulaGenerators()
Init
public complex Init(complex pz)
- Description copied from class:
Formula
- 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)
- Description copied from class:
Formula
- 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