kcc5
Class KCC_SpiralTrap

Object
  extended by common:Generic
      extended by common:TrapShape
          extended by kcc5:KCC_PlaneCurveTrapBase
              extended by kcc5:KCC_SpiralTrap

class 
KCC_PlaneCurveTrapBase:KCC_SpiralTrap

The Spiral trap.

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


Ultra Fractal Source

Toggle UF Source Code Display

 class KCC_SpiralTrap( KCC_PlaneCurveTrapBase ) {
 ; The Spiral trap.
 ; <p>
 ; For an example of what this trap looks like,
 ; <a href="../additional/kcc5/images/Spiral Trap.jpg">click here</a>.
 ;
 public:
   import "common.ulb"
 
   ; constructor
   func KCC_SpiralTrap( Generic pparent )
     KCC_PlaneCurveTrapBase( pparent )
   endfunc
 
   ; call this before each sequence of values to be trapped
   func Init( complex pz )
     KCC_PlaneCurveTrapBase.Init( pz )
   endfunc
 
   ; call this for each iteration being trapped
   float func Iterate( complex pz )
     pz = ApplyRatioAndSize( pz )
 
     x = real( pz )
     y = imag( pz )
 
     ; Compute the Spiral Curve.
     float dist = abs((x^(2*@shapeAdjust2)+y^(2*@shapeAdjust3))^ \
            @shapeAdjust1%1-.5+atan2(x*@shapeAdjust4+ \
            (flip(y^@shapeAdjust5)))/(2*pi))
     float dist2 = abs((x^(2*@shapeAdjust6)+y^2)^@shapeAdjust1%1-.5+ \
             atan2(x+flip(y))/(2*pi)+1)
     if dist2 < dist
       dist = dist2
     endif
 
     dist2 = abs((x^(2*@shapeAdjust6)+y^2)^@shapeAdjust1%1-.5+atan2(x+flip(y))/(2*pi)-1)
     if dist2 < dist
       dist = dist2
     endif
 
     pz = dist
 
     ; Check to see if the point is trapped.
     return KCC_PlaneCurveTrapBase.Iterate( pz )
   endfunc
 
   float func GetTextureValue()
     return m_Texture
   endfunc
 
 protected:
   float x
   float y
 
 default:
   title = "Spiral Trap"
 
   int param v_KCC_SpiralTrap
     caption = "Version (KCC_SpiralTrap)"
     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_SpiralTrap < 100
   endparam
 
   float param distort
     caption = "Fission"
     hint = "Generally stretches and splits the elements"
     default = 0
     visible = @adv
   endparam
 
   float param shapeAdjust1
     caption = "Shape Adj. I"
     default = 1.0
     hint = "Shape adjustment parameter I."
   endparam
 
   float param shapeAdjust2
     caption = "Shape Adj. II"
     default = 1.0
     hint = "Shape adjustment parameter II."
   endparam
 
   float param shapeAdjust3
     caption = "Shape Adj. III"
     default = 1.0
     hint = "Shape adjustment parameter III."
     visible = @adv
   endparam
 
   float param shapeAdjust4
     caption = "Shape Adj. IV"
     default = 1.0
     hint = "Shape adjustment parameter IV."
     visible = @adv
   endparam
 
   float param shapeAdjust5
     caption = "Shape Adj. V"
     default = 1.0
     hint = "Shape adjustment parameter V."
     visible = @adv
   endparam
 
   float param shapeAdjust6
     caption = "Shape Adj. VI"
     default = 1.0
     hint = "Shape adjustment parameter VI."
     visible = @adv
   endparam
 }
 


Constructor Summary
KCC_SpiralTrap()
           
KCC_SpiralTrap(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 kcc5:KCC_PlaneCurveTrapBase
ApplyRatioAndSize
 
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_SpiralTrap

public KCC_SpiralTrap(Generic pparent)
constructor


KCC_SpiralTrap

public KCC_SpiralTrap()
Method Detail

Init

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

Overrides:
Init in class KCC_PlaneCurveTrapBase

Iterate

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

Overrides:
Iterate in class KCC_PlaneCurveTrapBase

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 KCC_PlaneCurveTrapBase
Returns:
the texture value for the last point used (i.e. call GetTextureValue() after calling Iterate(), not before)