|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:Coloring
common:GradientColoring
Standard:Standard_ExponentialSmoothing
class
Object version of ExponentialSmoothing in Standard.ucl.
This coloring method provides smooth iteration colors for all fractal types,
convergent or divergent (or both). It combines the two methods developed by
Ron Barnett. It doesn't map precisely to iterations, but it's close.
Originally written by Damien M. Jones
class Standard_ExponentialSmoothing(common.ulb:GradientColoring) {
;
; Object version of ExponentialSmoothing in Standard.ucl.
;
; This coloring method provides smooth iteration colors for all fractal types,
; convergent or divergent (or both). It combines the two methods developed by
; Ron Barnett. It doesn't map precisely to iterations, but it's close.
;
; Originally written by Damien M. Jones
;
public:
func Init(complex pz, complex ppixel)
fSum = 0
fSum2 = 0
fZOld = (0, 0)
endfunc
func Iterate(complex pz)
if @diverge
fSum = fSum + exp(-cabs(pz))
endif
if @converge
fSum2 = fSum2 + exp(-1 / cabs(fZOld - pz))
endif
fZOld = pz
endfunc
float func ResultIndex(complex pz)
if |pz - fZOld| < 0.5 ; convergent bailout.
if @converge
return fSum2
else
return 0
endif
else ; divergent bailout
if @diverge
return fSum * @divergeScale
else
return 0
endif
endif
endfunc
private:
float fSum
float fSum2
complex fZOld
default:
title = "Exponential Smoothing"
helpfile = "Uf*.chm"
helptopic = "Html/coloring/standard/exponentialsmoothing.html"
rating = recommended
param diverge
caption = "Color Divergent"
default = false
hint = "If checked, points which escape to infinity will be \
colored."
endparam
param converge
caption = "Color Convergent"
default = true
hint = "If checked, points which collapse to one value will be \
colored."
endparam
param divergescale
caption = "Divergent Density"
default = 1.0
exponential = true
hint = "Sets the divergent coloring density, relative to the \
convergent coloring. If set to 1.0, they will use \
the same color density."
endparam
}
| Constructor Summary | |
|---|---|
Standard_ExponentialSmoothing()
|
|
| 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 |
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 Standard_ExponentialSmoothing()
| 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 - first value for the sequence; for a normal coloring formula, this will be #zppixel - seed value for the sequence; for a normal coloring formula, this will be #pixelpublic 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 - next value in the sequence; corresponds to #z in a coloring formulapublic 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 GradientColoring
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||