reb
Class REB_TrapShapeHopalong2

Object
  extended by common:Generic
      extended by common:TrapShape
          extended by reb:REB_TrapShapeHopalong2

class 
TrapShape:REB_TrapShapeHopalong2

Uses the Hopalong strange attractor as the trap shape. Can also be used as a texture.


Ultra Fractal Source

Toggle UF Source Code Display

 class REB_TrapShapeHopalong2(common.ulb:TrapShape) {
 ; Uses the Hopalong strange attractor as the trap shape. Can also be used as a texture.
  public:
    import "common.ulb"
 
 ; Constructor
    func REB_TrapShapeHopalong2(Generic pparent)
      TrapShape.TrapShape(pparent)
    endfunc
    
   ; Call this for each iteration being trapped.      
    float func Iterate(complex pz)
     TrapShape.Iterate(pz)
      float scale = sqrt(@h1*@h1+@h2*@h2+@h3*@h3)
      scale = @scaleadj*scale
     int sgn = 1
     if @sgn
       sgn = -1
     endif
      complex p = pz
      p = @fn1(p)
      float x = real(p)*scale
      float y = imag(p)*scale
      float pxx = 0
      int att_iter = 0
 
      while att_iter < @max_att_iterations
        pxx = x
        if x != 0
          x = y - x/abs(x)*sqrt(abs(@h2*x-@h3))
        else
          x = y - sqrt(abs(@h2*x-3))
        endif
        y = @h1 - pxx
        att_iter = att_iter + 1
      endwhile
      m_LastZ = @fn2(x + sgn*flip(y))
      float d = abs(|pz| - |m_LastZ|)
      return d
    endfunc
    
  default:
    title = "Hopalong 2"
   int param v_trapshapehopalong2
     caption = "Version (Trap Shape Hopalong 2)"
     default = 101
     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_trapshapehopalong2 < 101
   endparam
    
    float param h1
      caption = "Hopalong param 1"
      default = 0.4
    endparam
    float param h2
      caption = "Hopalong param 2"
      default = 1
    endparam
    float param h3
      caption = "Hopalong param 3"
      default = 0
    endparam
    float param scaleadj
      caption = "Scale"
      default = 1
    endparam
    int param max_att_iterations
      caption = "Attractor iterations"
      default = 1
    endparam
   func fn1
     caption = "Pre Function"
     default = atan()
   endfunc
   func fn2
     caption = "Post Function"
     default = sinh()
   endfunc
    bool param sgn
      caption = "Conjugate transform"
      default = false
    endparam
  }
 


Constructor Summary
REB_TrapShapeHopalong2()
           
REB_TrapShapeHopalong2(Generic pparent)
          Constructor
 
Method Summary
 float Iterate(complex pz)
          Call this for each iteration being trapped.
 
Methods inherited from class common:TrapShape
GetColorChannel, GetTextureValue, GetTransformedPoint, Init, IterateSilent, SetThreshold
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

REB_TrapShapeHopalong2

public REB_TrapShapeHopalong2(Generic pparent)
Constructor


REB_TrapShapeHopalong2

public REB_TrapShapeHopalong2()
Method Detail

Iterate

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

Overrides:
Iterate in class TrapShape