ck
Class BlendFormula

Object
  extended by common:Generic
      extended by common:Formula
          extended by ck:ckFormulaObject
              extended by ck:BlendFormula

class 
ckFormulaObject:BlendFormula

This Formula let you choose 2 Fractal Formulas, and blend them with this formula you can transform any fractal into any other the only thing you should be aware is that mixing Divergent and Convergent can lead to problems ... christian kleinhuis 2008 visit: fractalforums.com fractalmovies.com


Ultra Fractal Source

Toggle UF Source Code Display

 class BlendFormula(ck.ulb:ckFormulaObject) {
 ;
 
 ; This Formula let you choose 2 Fractal Formulas,
 ; and blend them with this formula you can transform any fractal into any other
 ; the only thing you should be aware is that mixing Divergent and Convergent
 ; can lead to problems ...
 ; christian kleinhuis 2008
 ; visit:
 ; fractalforums.com
 ; fractalmovies.com
 ;
 public:
   import "Common.ulb"
   import "Standard.ulb"
   complex func Init(complex pz)
     interpolator=new @Interpolator(this);
     f[0]=new @formulaClass1(this)
     f[1]=new @formulaClass2(this)
     z1=f[1].Init(pz);
     z0= f[0].Init(pz);
     return interpolator.Interpolate(@blend,z0,z1)
   endfunc
 
 ; @return the primary exponent parameter
   complex func GetPrimaryExponent()
   e1=f[0].GetPrimaryExponent()
   e2=f[1].GetPrimaryExponent()
   
     if cabs(e1)>cabs(e2)
        return e1
     else
         return e2
     endif
   endfunc
   complex func Iterate(complex pz)
 
   
   if(@blend==0)
              return f[0].Iterate(pz)
 
   elseif (@blend==1)
              return f[1].Iterate(pz)
 
   else
   
           return interpolator.Interpolate(@blend,f[0].Iterate(pz),f[1].Iterate(pz))
  endif
   endfunc
 
   bool func IsBailedOut(complex pz)
   return f[0].IsBailedOut(pz) ||f[1].IsBailedOut(pz)
   endfunc
 private:
   Formula f[2];
   ComplexInterpolator interpolator;
 default:
   title = "Blend Formula"
   rating = recommended
  Formula param formulaClass1
     caption = "First Formula"
     default = Standard_Mandelbrot
   endparam
  Formula param formulaClass2
     caption = "Second Formula"
     default = Standard_Mandelbrot
   endparam
 
   ComplexInterpolator param interpolator
       default= ComplexInterpolator
   endparam
 
 float param blend
     caption = "Blend"
     default = 0.5
   endparam
 }
 


Constructor Summary
BlendFormula()
           
 
Method Summary
 complex GetPrimaryExponent()
          Determine the primary exponent.
 complex Init(complex pz)
          Set up for a sequence of values
 boolean IsBailedOut(complex pz)
          Test whether the formula has bailed out (i.e.
 complex Iterate(complex pz)
          Produce the next value in the sequence
 
Methods inherited from class common:Formula
GetLowerBailout, GetUpperBailout
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

BlendFormula

public BlendFormula()
Method Detail

Init

public complex Init(complex pz)
Description copied from class: Formula
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 Formula
Parameters:
pz - seed value for the sequence; for a normal fractal formula, this will be #pixel
Returns:
first value in the sequence; this corresponds to #z in a fractal formula

GetPrimaryExponent

public complex GetPrimaryExponent()
Description copied from class: Formula
Determine the primary exponent.

Many fractals can be characterized by an exponent value that is useful to other formulas, so we provide that here. If your formula does not need or use this value, override the p_power parameter and make it hidden.

Overrides:
GetPrimaryExponent in class Formula
Returns:
the primary exponent parameter

Iterate

public complex Iterate(complex pz)
Description copied from class: Formula
Produce 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.

Overrides:
Iterate in class Formula
Parameters:
pz - previous value in the sequence; corresponds to #z in a fractal formula. Note that you should always use this value for computing the next iteration, rather than a saved value, as the calling code may modify the returned value before passing it back to the next Iterate() call.
Returns:
the next value in the sequence

IsBailedOut

public boolean IsBailedOut(complex pz)
Description copied from class: Formula
Test whether the formula has bailed out (i.e. the sequence is complete)

This is typically called once per iteration to test whether the sequence has completed. If producing this result is difficult to do separately from the Iterate() processing, you should produce the result in Iterate() and set the m_BailedOut flag appropriately, and leave IsBailedOut() unimplemented in your class to inherit this behavior.

Note that this test is the OPPOSITE sense of the bailout: section in UF's fractal formulas. A bailout: section returns TRUE to continue iterating. IsBailedOut() must return FALSE to continue iterating.

Overrides:
IsBailedOut in class Formula
Parameters:
pz - last sequence value to test; this should be the value returned from the previous Iterate() call. Note that it is acceptable to ignore pz and use m_BailedOut, but any code calling IsBailedOut() should pass in the correct pz for Formula classes which do not use m_BailedOut.
Returns:
true if the sequence has bailed out (i.e. should be terminated)