dmj5
Class DMJ_TransformRepeat

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

class 
UserTransform:DMJ_TransformRepeat

Repeat a transform a certain number of times.


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_TransformRepeat(common.ulb:UserTransform) {
   ; Repeat a transform a certain number of times.
   
 public:
   import "common.ulb"
   
   func DMJ_TransformRepeat(Generic pparent)
     UserTransform.UserTransform(pparent)
     
     m_Rotation = (0,1) ^ (@p_angle / 90.0)
     m_RotationReset = (0,1) ^ (-@p_resetcount * @p_angle / 90.0)
     m_Transform = new @f_transform(this)
   endfunc
 
   func Init(complex pz)
     UserTransform.Init(pz)
     
     m_Transform.Init(pz)
   endfunc
 
   complex func Iterate(complex pz)
     m_Iterations = m_Iterations + 1
 
     complex zt
     int resetcount = 0
     int j = 0
     while (j < @p_repeat)
       zt = m_Transform.Iterate(pz)
       if (@p_autoscale)
         zt = pz + (zt-pz)/@p_repeat
       endif
       zt = zt * m_Rotation
       if (@p_resetcount > 0)
         resetcount = resetcount + 1
         if (resetcount == @p_resetcount)
           zt = zt * m_RotationReset
           resetcount = 0
         endif
       endif
       pz = zt + @p_offset
       j = j + 1
     endwhile
 
     return pz
   endfunc
 
 protected:
   complex m_Rotation
   complex m_RotationReset
   Transform m_Transform
 
 default:
   title = "Repeat Transform"
 
   int param v_dmj_transformrepeat
     caption = "Version (DMJ_TransformRepeat)"
     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_transformrepeat < 100
   endparam
 
   int param p_repeat
     caption = "Iterations"
     default = 100
     hint = "Sets the number of times to repeat the transform."
   endparam
   float param p_angle
     caption = "Rotation"
     default = 90.0
     hint = "The transformed point will be rotated by this angle (in degrees) at every iteration."
   endparam
   int param p_resetcount
     caption = "Reset Rotation"
     default = 2
     hint = "After this many iterations, the rotation will be 'reset' by rotating in the reverse direction in an amount equal to the previous rotations combined. You can use this parameter to do popcorn-like effects by setting it to 180 divided by the rotation angle. Use 90 and 2 for classic popcorn, 60 and 3 for triangular popcorn, etc. (assuming you are using Linear Wave as your repeated transform). Use a value of zero to disable this."
   endparam
   complex param p_offset
     caption = "Offset"
     default = (0,0)
     hint = "This offset will be added to the transformed point at every iteration."
   endparam
   bool param p_autoscale
     caption = "Auto-Scale Transform"
     default = true
     hint = "If this is checked, the amount of change from the transform will automatically be reduced to be proportional to the number of iterations. This allows the overall amount of transformation to remain roughly the same while taking advantage of finer-grained feedback. If you uncheck this, the transform will be applied at full strength with every iteration, and as you change the number of times the transform is applied you may need to adjust parameters within the transform to compensate."
   endparam
     
   UserTransform param f_transform
     caption = "Transform"
     default = DMJ_LinearWave
     hint = "This is the transform that will be repeated."
   endparam
 }
 


Constructor Summary
DMJ_TransformRepeat()
           
DMJ_TransformRepeat(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_TransformRepeat

public DMJ_TransformRepeat(Generic pparent)

DMJ_TransformRepeat

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