reb
Class REB_Switch_EmbossedHelper

Object
  extended by reb:REB_Switch_EmbossedHelper

class 
Object:REB_Switch_EmbossedHelper

Helper class for Switch_Embossed.


Ultra Fractal Source

Toggle UF Source Code Display

 class REB_Switch_EmbossedHelper {
 ; Helper class for Switch_Embossed.
 public:
   import "common.ulb"
 
   func REB_Switch_EmbossedHelper(REB_Switch_Embossed owner)
     fOwner = owner
     fFormula = new @formulaClass(owner)
     fFormula2 = new @formulaclass2(owner)
     fTransform = new @transform(owner)
     fTransform2 = new @transform2(owner)
   endfunc
 
   func Init(const complex pz)
     fOwner.GetParams(m_mand, m_jul, m_c)
     fFormula.SetParams(m_mand, m_jul, m_c)
     fZ = fFormula.Init(pz)
     if @dual
       fFormula2.SetParams(m_mand, m_jul, m_c)
       fFormula2.Init(pz)
     endif
     fTransform.init(fZ)
     fTransform2.init(fZ)
     fBailedOut = false
     fResult = 0
     m_iter = 0
   endfunc
 
   complex func Iterate()
     if !fBailedOut
       if (m_iter >= @prestart && m_iter < (@prestart+@preend))&& @transform \
          != NullTransform
         fZ = (fZ + fTransform.Iterate(fZ)*@strength)/(1+@strength)
       endif
       fZ = fFormula.Iterate(fZ)
       if @dual
         fZ = fFormula2.iterate(fZ)
       endif
       if (m_iter >= @poststart && m_iter < (@poststart+@postend))&& @transform2 \
          != NullTransform
         fZ = (fZ + fTransform2.Iterate(fZ)*@strength2)/(1+@strength2)
       endif
 
       if fFormula.IsBailedOut(fZ)
         fBailedOut = true
 
         ; Handle emboss types that only work with the last iteration.
         if (@parttype == "Iteration")
           fResult = fOwner.getIteration()
         elseif (@parttype == "Magnitude")
           fResult = real(trunc(log(fZ)))
         elseif (@parttype == "Angle")
           float t = 0.5 * atan2(fZ) / #pi
           if (t < 0.0)
             t = t + 1.0
           endif
           t = t * @numsect
           fResult = real(trunc(t))
         endif
       endif
 
       ; Handle emboss types that need to do something for each iteration.
       if (@parttype == "Real(z) > 0")
         if (real(fZ) > 0.0)
           fResult = fResult + 1.0
         endif
       elseif (@parttype == "Imag(z) > 0")
         if (imag(fZ) > 0.0)
           fResult = fResult + 1.0
         endif
       elseif (@parttype == "Smallest Magnitude")
         float r = |fZ|
         if fOwner.updateRMin(r)
           fResult = fOwner.getIteration()
         endif
       elseif @parttype == "Sum(z) > 0"
         if real(fZ) + imag(fZ) > 0
           fResult = fResult + 1.0
         endif
       endif
     endif
     m_iter = m_iter + 1
     return fZ
   endfunc
 
   bool func IsBailedOut()
     return fBailedOut
   endfunc
 
   float func GetResult()
     return fResult
   endfunc
 
 private:
   bool fBailedOut
   Switch fFormula
   Switch fFormula2
   UserTransform fTransform
   UserTransform fTransform2
   REB_Switch_Embossed fOwner
   float fResult
   complex fZ
   int m_iter
   bool m_jul
   bool m_mand
   complex m_c
 
 default:
   param parttype
     caption="Emboss Type"
     default=0
     hint = "Specifies what information from the fractal is used to \
             create the embossing effect. This changes the shape of \
             the embossing lines."
     enum="Iteration" "Real(z) > 0" "Imag(z) > 0" "Sum(z) > 0" \
          "Smallest Magnitude" "Magnitude" "Angle"
   endparam
   param numsect
     caption="Number of Sections"
     default=2
     min=1
     hint = "Specifies the number of sections to use for the Angle \
             emboss type."
     visible = @parttype == "Angle"
   endparam
   UserTransform param transform
     caption = "Pre transform"
     default = NullTransform
     expanded = false
   endparam
   int param prestart
     caption = "Start Iter (Pre)"
     default = 0
     visible = @transform != NullTransform
   endparam
   int param preend
     caption = "Iterations (Pre)"
     default = 1
     visible = @transform != NullTransform
   endparam
   float param strength
     caption = "Strength (Pre)"
     default = 1
     visible = @transform != NullTransform
   endparam
   bool param dual
     caption = "Use dual formulas"
     default = false
   endparam
   Switch param formulaClass
     caption = "Fractal formula"
     default = REB_MandelbrotJulia_Switch
     hint = "Sets the actual fractal formula to use for the embossing effect."
   endparam
   Switch param formulaClass2
     caption = "Fractal Formula"
     default = REB_Ikenaga_Switch
     visible = @dual
   endparam
   UserTransform param transform2
     caption = "Post transform"
     default = NullTransform
     expanded = false
   endparam
   int param poststart
     caption = "Start Iter (Post)"
     default = 0
     visible = @transform2 != NullTransform
   endparam
   int param postend
     caption = "Iterations (Post)"
     default = 1
     visible = @transform2 != NullTransform
   endparam
   float param strength2
     caption = "Strength (Post)"
     default = 1
     visible = @transform2 != NullTransform
   endparam
 }
 


Constructor Summary
REB_Switch_EmbossedHelper()
           
REB_Switch_EmbossedHelper(REB_Switch_Embossed owner)
           
 
Method Summary
 float GetResult()
           
 void Init(complex pz)
           
 boolean IsBailedOut()
           
 complex Iterate()
           
 
Methods inherited from class Object
 

Constructor Detail

REB_Switch_EmbossedHelper

public REB_Switch_EmbossedHelper(REB_Switch_Embossed owner)

REB_Switch_EmbossedHelper

public REB_Switch_EmbossedHelper()
Method Detail

Init

public void Init(complex pz)

Iterate

public complex Iterate()

IsBailedOut

public boolean IsBailedOut()

GetResult

public float GetResult()