kcc5
Class KCC_SpheroidsTrap

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

class 
TrapShape:KCC_SpheroidsTrap

The Spheroids trap.

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


Ultra Fractal Source

Toggle UF Source Code Display

 class KCC_SpheroidsTrap( common.ulb:TrapShape ) {
 ; The Spheroids trap.
 ; <p>
 ; For an example of what this trap looks like,
 ; <a href="../additional/kcc5/images/Spheroids Trap.jpg">click here</a>.
 ;
 public:
   import "common.ulb"
 
   ; constructor
   func KCC_SpheroidsTrap( Generic pparent )
     TrapShape.TrapShape( pparent )
   endfunc
 
   ; call this before each sequence of values to be trapped
   func Init( complex pz )
     TrapShape.Init( pz )
     
     distance = 1e20
   endfunc
 
   ; call this for each iteration being trapped
   float func Iterate( complex pz )
     TrapShape.Iterate( pz )
 
     if( (delta = |pz + (0,-.5)|) < @spheroidSize )
       distance = @spheroidSize - delta
     elseif( (delta = |pz + (0,.5)|) < @spheroidSize )
       distance = @spheroidSize - delta
     elseif( (delta = |pz + (-.5,0)|) < @spheroidSize )
       distance = @spheroidSize - delta
     elseif( (delta = |pz + (.5,0)|) < @spheroidSize )
       distance = @spheroidSize - delta
     endif
 
     if( distance < @spheroidSize )
       m_LastChannel = m_Iterations
       m_Texture = 1.0 - distance / @spheroidSize
       return distance
     else
       return 1e20
     endif
   endfunc
 
   float func GetTextureValue()
     return m_Texture
   endfunc
 
 protected:
   float distance
   float delta
   float m_Texture
 
 default:
   title = "Spheroids Trap"
 
   int param v_KCC_SpheroidsTrap
     caption = "Version (KCC_SpheroidsTrap)"
     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_SpheroidsTrap < 100
   endparam
 
   float param spheroidSize
     caption = "Sphere Size"
     default = 0.1
     hint = "The size of the spheres.  Suggested range (0.01 to 1.0)."
   endparam
 }
 


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

public KCC_SpheroidsTrap(Generic pparent)
constructor


KCC_SpheroidsTrap

public KCC_SpheroidsTrap()
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)