|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:Coloring
common:GradientColoring
mmf:DistanceEstimatorBase
mmf:MMF_StandardDistanceEstimator
class
Distance Estimator for formulas of the form z^p+c.
class MMF_StandardDistanceEstimator(DistanceEstimatorBase) {
; Distance Estimator for formulas of the form z^p+c.
public:
import "common.ulb"
; @param pparent the parent, generally "this" for the parent, or zero
func MMF_StandardDistanceEstimator(Generic pparent)
DistanceEstimatorBase.DistanceEstimatorBase(pparent)
endfunc
; @param pz
; @param ppixel
func Init(complex pz, complex ppixel)
DistanceEstimatorBase.Init(pz, ppixel)
sz = dz = 1.0
if @julia && @mode=="Angle"
sz = @power*pz^(@power - 1)
m_Iterations = 1
endif
endfunc
; @param pz
func Iterate(complex pz)
if !@julia && m_Iterations==0
sz = @power*pz^(@power - 1)
elseif @julia || m_Iterations>0
dz = @power*dz*pz^(@power - 1)
endif
m_Iterations = m_Iterations + 1
endfunc
; @param pz
; @return the gradient index
float func ResultIndex(complex pz)
float a = 0.0
float d = 0.0
if @mode=="Angle" || @mode=="Combined"
if (a = atan2(pz/(dz*sz))*(0.5/#pi))<0.0
a = a + 1.0
endif
if @mode=="Angle"
return a
endif
endif
if @mode=="Distance" || @mode=="Combined"
d = cabs(pz)
d = cabs((@power*log(d)*d/cabs(dz))^(1.0/@power))
if @mode=="Distance"
return d
endif
endif
return a+d
endfunc
; @param pz
; @return the distance
float func ResultDistance(complex pz)
d = cabs(pz)
return cabs((@power*log(d)*d/cabs(dz))^(1.0/@power))
endfunc
; @param pz
; @return the angle (from 0 to 1)
float func ResultAngle(complex pz)
float r
if (r=atan2(pz/(dz*sz))*(0.5/#pi))<0.0
r = r + 1.0
endif
return r
endfunc
protected:
complex sz
default:
title = "MMF Standard Distance Estimator"
int param v_mmf_standarddistanceestimator
caption = "Version (MMF Standard Distance Estimator)"
enum = "1.0"
default = 0
hint = "This field is to absolutely ensure backward compatibility, \
the default will always be set to the latest version, but \
there may be some cases where an older effect that you like \
is lost in an update and you could still use it by selecting \
the older version number."
visible = false
endparam
bool param julia
caption = "Julia ?"
default = false
hint = "Enable if your main formula is a Julia."
endparam
int param mode
caption = "Mode"
enum = "Distance" "Angle" "Combined"
default = 0
endparam
complex param power
caption = "Power (p in z^p+c)"
default = (2,0)
endparam
}
| Constructor Summary | |
|---|---|
MMF_StandardDistanceEstimator()
|
|
MMF_StandardDistanceEstimator(Generic pparent)
|
|
| Method Summary | |
|---|---|
void |
Init(complex pz,
complex ppixel)
Set up for a sequence of values |
void |
Iterate(complex pz)
Process the next value in the sequence |
float |
ResultAngle(complex pz)
|
float |
ResultDistance(complex pz)
|
float |
ResultIndex(complex pz)
Produce a resulting color index after a sequence is finished |
| Methods inherited from class common:GradientColoring |
|---|
IsGradient, IsSolid, Result |
| Methods inherited from class common:Coloring |
|---|
GetPixel |
| Methods inherited from class common:Generic |
|---|
GetParent |
| Methods inherited from class Object |
|---|
|
| Constructor Detail |
|---|
public MMF_StandardDistanceEstimator(Generic pparent)
pparent - the parent, generally "this" for the parent, or zeropublic MMF_StandardDistanceEstimator()
| Method Detail |
|---|
public void Init(complex pz,
complex ppixel)
GradientColoringThis function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit).
Init in class GradientColoringpz - ppixel - public void Iterate(complex pz)
GradientColoringAs long as the sequence has not bailed out, this function will be continually called to produce sequence values. Note that such processing generally will not know in advance precisely how long the sequence is, and should be prepared to deal with sequences of arbitrary length.
Your coloring may determine at some point that a solid color should be used rather than an index value.
Iterate in class GradientColoringpz - public float ResultIndex(complex pz)
GradientColoringThis corresponds to the final: section in a coloring formula. Once it is called, no further calls to Iterate() should be made without calling Init() first.
ResultIndex in class GradientColoringpz -
public float ResultDistance(complex pz)
ResultDistance in class DistanceEstimatorBasepz -
public float ResultAngle(complex pz)
ResultAngle in class DistanceEstimatorBasepz -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||