|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:Coloring
common:GradientColoring
mt:MT_DiskTexture
class
Mark Townsend, May 2008
class MT_DiskTexture(common.ulb:GradientColoring) {
;
; Mark Townsend, May 2008
;
public:
func MT_DiskTexture(Generic pparent)
GradientColoring(pparent)
fTexture = new @p_texture(this)
endfunc
func Init(complex pz, complex ppixel)
GradientColoring.Init(pz, ppixel)
fTexture.Init(pz)
fW = 0
fIter = 0
fMax_iter = 0
endfunc
func Iterate(complex pz)
fIter = fIter + 1
if cabs(pz - @doffset) < @r
float d = (@r - cabs(pz - @doffset)) / @r
fW = fW + d * pz
fMax_iter = fIter
endif
endfunc
float func ResultIndex(complex pz)
float index = 0
if @coloring == 0
index = 0.1 * cabs(fW)
elseif @coloring == 1
index = 0.1 * abs(real(fW))
elseif @coloring == 2
index = 0.1 * abs(imag(fW))
elseif @coloring == 3
float b = atan2(fW)
if b < 0
b = b + 2 * #pi
endif
b = 1 / (2 * #pi) * b
index = b
elseif @coloring == 4
index = 0.1 * fMax_iter
elseif @coloring == 5
index = fTexture.Iterate(fW)
endif
return index
endfunc
private:
TrapShape fTexture
complex fW
int fIter
int fMax_iter
default:
title = "Disk Texture"
param coloring
caption = "Coloring mode"
enum = "Magnitude" "Real" "Imaginary" "Angle" "Iteration" "Texture"
endparam
param r
caption = "Disk radius"
default = 2.0
min = 0
endparam
param doffset
caption = "Disk offset"
default = (0,0)
endparam
TrapShape param p_texture
caption = "Texture"
default = MT_PerlinNoiseTexture
endparam
}
| Constructor Summary | |
|---|---|
MT_DiskTexture()
|
|
MT_DiskTexture(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 |
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 MT_DiskTexture(Generic pparent)
public MT_DiskTexture()
| 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 | ||||||||