kcc5
Class KCC_TwoEllipsesTrap

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

class 
TrapShape:KCC_TwoEllipsesTrap

The Two Ellipses trap.

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


Ultra Fractal Source

Toggle UF Source Code Display

 class KCC_TwoEllipsesTrap( common.ulb:TrapShape ) {
 ; The Two Ellipses trap.
 ; <p>
 ; For an example of what this trap looks like,
 ; <a href="../additional/kcc5/images/Two Ellipses Trap.jpg">click here</a>.
 ;
 public:
   import "common.ulb"
 
   ; constructor
   func KCC_TwoEllipsesTrap( 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 )
 
     angle = atan( imag( pz ) / real( pz ) )
     ellipse1 = @majorAxis1 * cos( angle ) + (0.0,0.0) * @minorAxis1 * sin( angle )
     ellipse2 = @minorAxis2 * cos( angle ) + (0.0,0.0) * @majorAxis2 * sin( angle )
     distance1 = abs( cabs( pz ) - cabs( ellipse1 ) )
     distance2 = abs( cabs( pz ) - cabs( ellipse2 ) )
 
     if( distance1 < distance2 )
       segment  = 0
       distance = distance1
     else
       segment  = 1
       distance = distance2
     endif
 
     if( distance < @ellipseWidth )
       m_LastChannel = m_Iterations + segment
       m_Texture = distance / @ellipseWidth
       return distance
     endif
     
     return 1e20
   endfunc
 
   float func GetTextureValue()
     return m_Texture
   endfunc
 
 protected:
   int segment
   float angle
   complex ellipse1
   complex ellipse2
   float distance
   float distance1
   float distance2
   float m_Texture
 
 default:
   title = "Two Ellipses Trap"
 
   int param v_KCC_TwoEllipsesTrap
     caption = "Version (KCC_TwoEllipsesTrap)"
     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_TwoEllipsesTrap < 100
   endparam
 
   float param ellipseWidth
     caption = "Elipse Width"
     default = 0.1
     hint = "The width of the ellipses."
   endparam
 
   float param majorAxis1
     caption = "Ellipse 1 Major Axis"
     default = 0.6
     hint = "The major axis length of ellipse 1."
   endparam
 
   float param minorAxis1
     caption = "Ellipse 1 Minor Axis"
     default = 0.6
     hint = "The minor axis length of ellipse 1."
   endparam
 
   float param majorAxis2
     caption = "Ellipse 2 Major Axis"
     default = 0.2
     hint = "The major axis length of ellipse 2."
   endparam
 
   float param minorAxis2
     caption = "Ellipse 2 Minor Axis"
     default = 0.2
     hint = "The minor axis length of ellipse 2."
   endparam
 }
 


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

public KCC_TwoEllipsesTrap(Generic pparent)
constructor


KCC_TwoEllipsesTrap

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