dmj5
Class DMJ_LinearWave

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UserTransform
              extended by dmj5:DMJ_LinearWave

class 
UserTransform:DMJ_LinearWave

Linear wave transformation. (Ported from dmj3.uxf:dmj3-LinearWave)


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_LinearWave(common.ulb:UserTransform) {
   ; Linear wave transformation.
   ; (Ported from dmj3.uxf:dmj3-LinearWave)
   
 public:
   import "common.ulb"
   
   func DMJ_LinearWave(Generic pparent)
     UserTransform.UserTransform(pparent)
   endfunc
   
   func Init(complex pz)
     UserTransform.Init(pz)
     m_WaveRotation = (0,1) ^ (@p_waveangle / 90.0)
     m_DistortionRotation = (0,1) ^ (@p_distortionangle / 90.0)
   endfunc
   
   complex func Iterate(complex pz)
     m_Iterations = m_Iterations + 1
 
     ; apply per-iteration wave distortion
     complex p = pz * m_WaveRotation
     float d = sin(real(p)*@p_distortionfrequency/#pi+@p_distortionphase/#pi)*@p_distortionstrength
     p = p + d * m_DistortionRotation
     pz = p * conj(m_WaveRotation)
 
     return pz
   endfunc
   
 protected:
   complex m_WaveRotation
   complex m_DistortionRotation
 
 default:
   title = "Linear Wave"
 
   int param v_dmj_linearwave
     caption = "Version (DMJ_LinearWave)"
     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_dmj_linearwave < 100
   endparam
 
   float param p_waveangle
     caption = "Wave Angle"
     default = 0.0
     hint = "Sets the angle the wave is generated at, in degrees."
   endparam
 
   float param p_distortionangle
     caption = "Distortion Angle"
     default = 0.0
     hint = "Sets the angle of the distortion, in degrees, relative to the wave angle."
   endparam
   float param p_distortionstrength
     caption = "Distortion Strength"
     default = 1.0
     hint = "Sets the amount of distortion the wave will cause."
   endparam
   float param p_distortionfrequency
     caption = "Distortion Frequency"
     default = 10.0
     hint = "Sets the frequency of the wave."
   endparam
   float param p_distortionphase
     caption = "Distortion Phase"
     default = 0.0
     hint = "Sets the phase of the wave, in degrees. Use this to shift the wave without changing its strength or direction."
   endparam
 }
 


Constructor Summary
DMJ_LinearWave()
           
DMJ_LinearWave(Generic pparent)
           
 
Method Summary
 void Init(complex pz)
          Set up for a sequence of values
 complex Iterate(complex pz)
          Transform a single point within a sequence
 
Methods inherited from class common:Transform
IsSolid, IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DMJ_LinearWave

public DMJ_LinearWave(Generic pparent)

DMJ_LinearWave

public DMJ_LinearWave()
Method Detail

Init

public void Init(complex pz)
Description copied from class: Transform
Set up for a sequence of values

This function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit). It will be called even if only one value is being transformed (e.g. a normal transformation formula). Use this to perform any setup that is exactly the same for each value in the sequence being transformed.

Overrides:
Init in class Transform
Parameters:
pz - the value representing the sequence; for a normal transformation formula use, this will be #pixel. In some cases this may differ from the first value passed to Iterate() if the calling code applies some other transformations.

Iterate

public complex Iterate(complex pz)
Description copied from class: Transform
Transform a single point within a sequence

After a sequence has been set up with Init(), this function will be called once for each value in the sequence. Note that all values in the sequence must be processed in order (they cannot be processed out of order). If the sequence contains only one value, Init() will still be called and then Iterate() will be called just once.

Overrides:
Iterate in class Transform
Parameters:
pz - the complex value to be transformed
Returns:
the transformed value