kcc5
Class KCC_BlobsTrap

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

class 
TrapShape:KCC_BlobsTrap

The Blobs trap.

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


Ultra Fractal Source

Toggle UF Source Code Display

 class KCC_BlobsTrap( common.ulb:TrapShape ) {
 ; The Blobs trap.
 ; <p>
 ; For an example of what this trap looks like,
 ; <a href="../additional/kcc5/images/Blobs Trap.jpg">click here</a>.
 ;
 public:
   import "common.ulb"
 
   ; constructor
   func KCC_BlobsTrap( Generic pparent )
     TrapShape.TrapShape( pparent )
   endfunc
 
   ; call this before each sequence of values to be trapped
   func Init( complex pz )
     TrapShape.Init( pz )
 
     r = @blobsRadius * 0.4782926234762
     r2 = r * r
     denom = @blobsMultiplier * r
     icd = 1.12484444888696 * r
     ocd = 1.83195123007351 * r
     ic0 = 1.59077027517603 * r
     oc0 = 2.59077027517603 * r
     cen0 = 2.09077027517603 * r
     cend = 1.47839783948023 * r
     i = (0.0,1.0)
     c0i = i * ic0
     c0o = i * oc0
     c1i = icd + i * icd
     c1o = ocd + i * ocd
     c2i = ic0
     c2o = oc0
     c3i = icd - i * icd
     c3o = ocd - i * ocd
     c4i = -c0i
     c4o = -c0o
     c5i = -c1i
     c5o = -c1o
     c6i = -c2i
     c6o = -c2o
     c7i = -c3i
     c7o = -c3o
     c0cen = i * cen0
     c1cen = cend + i * cend
     c2cen = cen0
     c3cen = cend - i * cend
     c4cen = -c0cen
     c5cen = -c1cen
     c6cen = -c2cen
     c7cen = -c3cen
   endfunc
 
   ; call this for each iteration being trapped
   float func Iterate( complex pz )
     TrapShape.Iterate( pz )
 
     c1 = ((|pz - c0i| < r2) && (|pz - c0o| < r2))
     c2 = ((|pz - c1i| < r2) && (|pz - c1o| < r2))
     c3 = ((|pz - c2i| < r2) && (|pz - c2o| < r2))
     c4 = ((|pz - c3i| < r2) && (|pz - c3o| < r2))
     c5 = ((|pz - c4i| < r2) && (|pz - c4o| < r2))
     c6 = ((|pz - c5i| < r2) && (|pz - c5o| < r2))
     c7 = ((|pz - c6i| < r2) && (|pz - c6o| < r2))
     c8 = ((|pz - c7i| < r2) && (|pz - c7o| < r2))
 
     if( c1 )
       distance = cabs( |pz| - |c0cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c2 )
       distance = cabs( |pz| - |c1cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c3 )
       distance = cabs( |pz| - |c2cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c4 )
       distance = cabs( |pz| - |c3cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c5 )
       distance = cabs (|pz| - |c4cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c6 )
       distance = cabs( |pz| - |c5cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c7 )
       distance = cabs( |pz| - |c6cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     elseif( c8 )
       distance = cabs( |pz| - |c7cen| )
       m_LastChannel = m_Iterations
       m_Texture = (distance / denom)^@blobsPower
       return distance
     endif
 
     return 1e20
   endfunc
 
   float func GetTextureValue()
     return m_Texture
   endfunc
 
 protected:
   float distance
   bool c1
   bool c2
   bool c3
   bool c4
   bool c5
   bool c6
   bool c7
   bool c8
   float r
   float r2
   float denom
   float icd
   float ocd
   float ic0
   float oc0
   float cen0
   float cend
   complex c0i
   complex c0o
   complex c1i
   complex c1o
   complex c2i
   complex c2o
   complex c3i
   complex c3o
   complex c4i
   complex c4o
   complex c5i
   complex c5o
   complex c6i
   complex c6o
   complex c7i
   complex c7o
   complex c0cen
   complex c1cen
   complex c2cen
   complex c3cen
   complex c4cen
   complex c5cen
   complex c6cen
   complex c7cen
   complex i
   float m_Texture
 
 default:
   title = "Blobs Trap"
 
   int param v_KCC_BlobsTrap
     caption = "Version (KCC_BlobsTrap)"
     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_BlobsTrap < 100
   endparam
 
   float param blobsRadius
     caption = "Blobs Size"
     default = 0.25
     hint = "The size of the blobs."
   endparam
 
   float param blobsMultiplier
     caption = "Blobs Multiplier"
     default = 0.5
     hint = "Blob factor multiplier."
   endparam
 
   float param blobsPower
     caption = "Blobs Power"
     default = 0.5
     hint = "Blob factor exponent."
   endparam
 }
 


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

public KCC_BlobsTrap(Generic pparent)
constructor


KCC_BlobsTrap

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