Standard
Class Standard_Triangle

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:GradientColoring
              extended by Standard:Standard_Triangle

class 
GradientColoring:Standard_Triangle

Object version of Triangle in Standard.ucl. Variation on the Triangle Inequality Average coloring method from Kerry Mitchell. The smoothing used here is based on the Smooth formula, which only works for z^n+c and derivates. Originally written by Damien M. Jones


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_Triangle(common.ulb:GradientColoring) {
 ;
 ; Object version of Triangle in Standard.ucl.
 ;
 ; Variation on the Triangle Inequality Average coloring method from Kerry
 ; Mitchell. The smoothing used here is based on the Smooth formula, which only
 ; works for z^n+c and derivates.
 ;
 ; Originally written by Damien M. Jones
 ;
 public:
   func Init(complex pz, complex ppixel)
     GradientColoring.Init(pz, ppixel)
     fSum = 0
     fSum2 = 0
     fAC = cabs(ppixel)
   endfunc
 
   func Iterate(complex pz)
     GradientColoring.Iterate(pz)
     fSum2 = fSum
     if m_Iterations > 1
       float az2 = cabs(pz - GetPixel())
       float lowbound = abs(az2 - fAC)
       fSum = fSum + ((cabs(pz) - lowbound) / (az2 + fAC - lowbound))
     endif
   endfunc
 
   float func ResultIndex(complex pz)
     fSum = fSum / m_Iterations
     fSum2 = fSum2 / (m_Iterations - 1)
     float il = 1 / log(@power)
     float lp = log(log(@bailout) / 2)
     float f = il * lp - il*log(log(cabs(pz)))
     return fSum2 + (fSum - fSum2) * (f + 1)
   endfunc
 
 private:
   float fAC
   float fSum
   float fSum2
 
 default:
   title = "Triangle Inequality Average"
   helpfile = "Uf*.chm"
   helptopic = "Html/coloring/standard/triangleinequalityaverage.html"
   rating = recommended
   param power
     caption = "Exponent"
     default = 2.0
     hint = "This should be set to match the exponent of the \
             formula you are using. For Mandelbrot, this is usually 2."
   endparam
   param bailout
     caption = "Bailout"
     default = 1e20
     min = 1
     exponential = true
     hint = "This should be set to match the bail-out value in \
             the Formula tab. Use a very high value for good results."
   endparam
 }
 


Constructor Summary
Standard_Triangle()
           
 
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

Standard_Triangle

public Standard_Triangle()
Method Detail

Init

public void Init(complex pz,
                 complex ppixel)
Description copied from class: GradientColoring
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 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)
Description copied from class: GradientColoring
Process 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. 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.

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)
Description copied from class: GradientColoring
Produce a resulting color index after a sequence is finished

This 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.

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