reb
Class REB_ExponentialSmoothing_Gradient

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:GradientColoring
              extended by reb:REB_ExponentialSmoothing_Gradient

class 
GradientColoring:REB_ExponentialSmoothing_Gradient

Based on the original 1994 algorithm of Ron Barnett.

This is a direct coloring formula that supports trap shape textures and colortrap coloring, including image import.


Ultra Fractal Source

Toggle UF Source Code Display

 class REB_ExponentialSmoothing_Gradient(common.ulb:GradientColoring) {
 ; Based on the original 1994 algorithm of Ron Barnett. <br>
 ; <p>
 ; This is a direct coloring formula that supports trap shape textures and
 ; colortrap coloring, including image import.
 public:
   import "common.ulb"
   import "dmj5.ulb"
 
   ; constructor
   func REB_ExponentialSmoothing_Gradient(Generic pparent)
     GradientColoring.GradientColoring(pparent)
     m_Texture = new @ftexture(this)
   endfunc
   
   ; initialize the objects
   func Init(complex pz, complex ppixel)
     GradientColoring.Init(pz, ppixel)
     m_Texture.Init(pz)
     m_iterexp = 0
     m_zold = (0,0)
   endfunc
   
   ; call for each iterated point
   func Iterate(complex pz)
     GradientColoring.Iterate(pz)
     if (@mtile == "Fixed Iteration" && m_iterations == @iternum) || \
        (@mtile == "Cabs(z)" && cabs(pz) < @tcabs)|| @mtile == "none"
       ptexture = m_Texture.Iterate(pz)
     endif
     if (@converge > 0)
        m_iterexp = m_iterexp + exp(-cabs(pz))
     else
        m_iterexp = m_iterexp + exp(-1/(cabs(m_zold - pz)))
     endif
     m_zold = pz
   endfunc
 
   ; override the parent and call in the final section of the coloring formula. <br>
   float func ResultIndex(complex pz)
     return 0.01*m_iterexp + ptexture*@txamt
   endfunc
 
 protected:
   float ptexture
   TrapShape m_Texture
   float m_iterexp
   complex m_zold
 
 default:
   title = "Exponential Smoothing Gradient"
   int param v_exponentialsmoothinggrad
     caption = "Version (Exponential Smoothing Gradient)"
     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_exponentialsmoothinggrad < 100
   endparam
   heading
     text = "This is a direct gradient formula with textures"
   endheading
   param converge
     caption = "Fractal Type"
     default = 1
     enum = "Convergent" "Divergent"
     hint = "Mandelbrot is Divergent, Newton is Convergent."
   endparam
   float param txamt
     caption = "Texture amount"
     default = 0.0
     visible = @fTexture != DMJ_TrapShapeFlat
   endparam
   heading
     text = "The 'Tile method' applies to textures. Fixed Iteration \
             will give a smoother tiling, while 'Cabs(z)' will more consistently \
             follow the fractal shape."
     visible = @fTexture != DMJ_TrapShapeFlat
   endheading
   param mtile
     caption = "Tile method"
     default = 1
     enum = "None" "Fixed Iteration" "Cabs(z)"
     visible = @fTexture != DMJ_TrapShapeFlat
   endparam
   int param iternum
     caption = "Iter number"
     default = 1
     visible = @mtile == "Fixed iteration" && @fTexture != DMJ_TrapShapeFlat
     hint = "Changes the texture/image mapping."
   endparam
   float param tcabs
     caption = "Cabs limit"
     default = 1.0
     visible = @mtile == "Cabs(z)"
     hint = "Changes the texture/image mapping."
     visible = @fTexture != DMJ_TrapShapeFlat
   endparam
   TrapShape param fTexture
     caption = "Texture"
     default = DMJ_TrapShapeFlat
     hint = "Use TrapShape plugins as textures."
   endparam
 }
 


Constructor Summary
REB_ExponentialSmoothing_Gradient()
           
REB_ExponentialSmoothing_Gradient(Generic pparent)
          constructor
 
Method Summary
 void Init(complex pz, complex ppixel)
          initialize the objects
 void Iterate(complex pz)
          call for each iterated point
 float ResultIndex(complex pz)
          override the parent and call in the final section of the coloring formula.
 
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

REB_ExponentialSmoothing_Gradient

public REB_ExponentialSmoothing_Gradient(Generic pparent)
constructor


REB_ExponentialSmoothing_Gradient

public REB_ExponentialSmoothing_Gradient()
Method Detail

Init

public void Init(complex pz,
                 complex ppixel)
initialize the objects

Overrides:
Init in class GradientColoring
Parameters:
pz - first value for the sequence; for a normal coloring formula, this will be #z
ppixel - seed value for the sequence; for a normal coloring formula, this will be #pixel

Iterate

public void Iterate(complex pz)
call for each iterated point

Overrides:
Iterate in class GradientColoring
Parameters:
pz - next value in the sequence; corresponds to #z in a coloring formula

ResultIndex

public float ResultIndex(complex pz)
override the parent and call in the final section of the coloring formula.

Overrides:
ResultIndex in class GradientColoring
Returns:
the gradient index (corresponding to #index in a coloring formula)