kcc5
Class KCC_HarlequinTrap

Object
  extended by common:Generic
      extended by common:TrapShape
          extended by kcc5:KCC_HarlequinTrap

class 
TrapShape:KCC_HarlequinTrap

The Harlequin trap.

For an example of what this trap looks like, click here.


Ultra Fractal Source

Toggle UF Source Code Display

 class KCC_HarlequinTrap( common.ulb:TrapShape ) {
 ; The Harlequin trap.
 ; <p>
 ; For an example of what this trap looks like,
 ; <a href="../additional/kcc5/images/Harlequin Trap.jpg">click here</a>.
 ;
 public:
   import "common.ulb"
 
   ; constructor
   func KCC_HarlequinTrap( Generic pparent )
     TrapShape.TrapShape( pparent )
   endfunc
 
   ; call this before each sequence of values to be trapped
   func Init( complex pz )
     TrapShape.Init( pz )
   endfunc
 
   ; call this for each iteration being trapped
   float func Iterate( complex pz )
     TrapShape.Iterate( pz )
 
     x = real( pz )
     ; If x == 0, then we have to treat temp as a special case because
     ; atan( y / 0 ) produces a NAN value which causes problems in the
     ; subsequent computations.
     if( x == 0 )
       return 1e20
     endif
     
     y = imag( pz )
     aa = @harlequinMultiplier * atan( y / x )
     aa = aa * aa + @harlequinSeed
     aa = @harlequinFunction( 1 - aa ) / aa
     temp = abs( |pz| - |aa| )
 
     if( temp < @harlequinSize )
       m_LastChannel = m_Iterations
       
       m_Texture = temp / @harlequinSize
       
       return temp
     else
       return 1e20
     endif
   endfunc
 
   float func GetTextureValue()
     return m_Texture
   endfunc
 
 protected:
   float x
   float y
   float temp
   complex aa
   float m_Texture
 
 default:
   title = "Harlequin Trap"
 
   int param v_KCC_HarlequinTrap
     caption = "Version (KCC_HarlequinTrap)"
     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_KCC_HarlequinTrap < 100
   endparam
 
   float param harlequinSize
     caption = "Harlequin Size"
     default = 0.1
     hint = "The size of the harlequin trap."
   endparam
 
   float param harlequinMultiplier
     caption = "Harlequin Multiplier"
     default = 2.0
     hint = "The angle multiplier for the harlequin trap."
   endparam
 
   complex param harlequinSeed
     caption = "Harlequin Seed"
     default = (0.15,1.26875)
     hint = "The seed for the harlequin trap."
   endparam
 
   func harlequinFunction
     caption = "Modifier Function"
     default = ident()
     hint = "Modifier function 1."
   endfunc
 }
 


Constructor Summary
KCC_HarlequinTrap()
           
KCC_HarlequinTrap(Generic pparent)
          constructor
 
Method Summary
 float GetTextureValue()
          Get texture value.
 void Init(complex pz)
          call this before each sequence of values to be trapped
 float Iterate(complex pz)
          call this for each iteration being trapped
 
Methods inherited from class common:TrapShape
GetColorChannel, GetTransformedPoint, IterateSilent, SetThreshold
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

KCC_HarlequinTrap

public KCC_HarlequinTrap(Generic pparent)
constructor


KCC_HarlequinTrap

public KCC_HarlequinTrap()
Method Detail

Init

public void Init(complex pz)
call this before each sequence of values to be trapped

Overrides:
Init in class TrapShape

Iterate

public float Iterate(complex pz)
call this for each iteration being trapped

Overrides:
Iterate in class TrapShape

GetTextureValue

public float GetTextureValue()
Description copied from class: TrapShape
Get texture value.

Ordinarily, a trap shape does not have a native texture (it is flat). Some formulas may pair trap shapes with trap textures, and may need more information about trap textures when trap shapes are nested via TrapShapeMerge. This function provides support for accessing texture information.

Overrides:
GetTextureValue in class TrapShape
Returns:
the texture value for the last point used (i.e. call GetTextureValue() after calling Iterate(), not before)