reb
Class TrapTransformMod

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UserTransform
              extended by reb:TrapTransformMod

class 
UserTransform:TrapTransformMod

Basic trap shape transform with trap modifier added.

the trap modifier field reproduces a parameter used in my old UF4 formulas.


Ultra Fractal Source

Toggle UF Source Code Display

 class TrapTransformMod(common.ulb:UserTransform) {
   ; Basic trap shape transform with trap modifier added. <br>
   ; <p>
   ; the trap modifier field reproduces a parameter used in my old UF4 formulas.
 public:
   import "common.ulb"
 
   ; constuctor
   func TrapTransformMod(Generic pparent)
     UserTransform.UserTransform(pparent)
   endfunc
 
   ; initialize the transform
   func Init(complex pz)
     UserTransform.Init(pz)
 
     m_Rotation = (0,1) ^ (@p_traprotation / 90.0)
     m_Skew = (0,1) ^ (@p_trapskew / 90.0)
     m_TrapCenter = @p_trapcenter
     if (@p_trapcentermoves)
       m_TrapCenter = m_TrapCenter + pz
     endif
     m_tmod = @tmod
   endfunc
 
   ; call for each iterated point
   complex func Iterate(complex pz)
     UserTransform.Iterate(pz)
 ;    m_Iterations = m_Iterations + 1
     
     ; apply per-iteration steps
     if (@p_trapdrift != (0,0))
       m_TrapCenter = m_TrapCenter + @p_trapdrift
     endif
     if (@p_traprotationstep != 0.0)
       m_Rotation = (0,1) ^ ((@p_traprotation + @p_traprotationstep*(m_Iterations-1)) / 90.0)
     endif
     if (@p_trapskewstep != 0.0)
       m_Skew = (0,1) ^ ((@p_trapskew + @p_trapskewstep*(m_Iterations-1)) / 90.0)
     endif
 
     ; apply offset and rotation and size
     pz = (pz - m_TrapCenter) * m_Rotation * recip(@p_trapscale)
     ; apply aspect
     if (@p_trapaspect != 1.0)
       pz = real(pz) + flip(imag(pz) * @p_trapaspect)
     endif
     ; apply skew
     pz = real(pz*m_Skew) + flip(imag(pz))
 
     ; apply trap modifier    
     pz = real(pz) + flip(imag(pz)*m_tmod)
     return pz
   endfunc
   
 protected:
   complex m_Rotation
   complex m_Skew
   complex m_TrapCenter
   float m_tmod
 
 default:
   title = "Trap Position Mod"
   int param v_trappositionmod
     caption = "Version (Trap Position Mod)"
     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_trappositionmod < 101
   endparam
   float param tmod
     caption = "Trap Modifier"
     default = 1.0
     hint = "Modifies the shape of the trap."
   endparam
   complex param p_trapcenter
     caption = "Trap Center"
     default = (0,0)
     hint = "This is the location of the trap in the complex plane."
   endparam
   bool param p_trapcentermoves
     caption = "Follows pixel location"
     default = false
     hint = "If this is enabled, the trap center will follow the pixel location, offset by the Trap Center amount."
   endparam
   complex param p_trapdrift
     caption = "Trap Drift"
     default = (0,0)
     hint = "This is the amount the trap center will move with each iteration."
   endparam
   float param p_trapscale
     caption = "Trap Scale"
     default = 1.0
     hint = "This can be used to resize the entire trap shape. This is different from adjusting the trap threshold because this resizes the complete trap evenly; adjusting the threshold may change the trap shape in unexpected ways (for some trap shapes). Use values smaller than 1.0 to shrink the trap shape, larger than 1.0 to enlarge it."
   endparam
   float param p_traprotation
     caption = "Rotation"
     default = 0.0
     hint = "This is the angle, in degrees, that the trap should be rotated."
   endparam
   float param p_traprotationstep
     caption = "Rotation Step"
     default = 0.0
     hint = "This is the angle, in degrees, that the trap will be rotated with each iteration."
   endparam
   float param p_trapskew
     caption = "Skew"
     default = 0.0
     hint = "This is the angle, in degrees, to skew the vertical axis of the trap shape."
   endparam
   float param p_trapskewstep
     caption = "Skew Step"
     default = 0.0
     hint = "This is the angle, in degrees, that the skew angle should be increased by with each iteration."
   endparam
   float param p_trapaspect
     caption = "Aspect Ratio"
     default = 1.0
     hint = "This is how square the trap is. You can distort the trap by using a value other than 1.0."
   endparam
 }
 


Constructor Summary
TrapTransformMod()
           
TrapTransformMod(Generic pparent)
          constuctor
 
Method Summary
 void Init(complex pz)
          initialize the transform
 complex Iterate(complex pz)
          call for each iterated point
 
Methods inherited from class common:Transform
IsSolid, IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

TrapTransformMod

public TrapTransformMod(Generic pparent)
constuctor


TrapTransformMod

public TrapTransformMod()
Method Detail

Init

public void Init(complex pz)
initialize the transform

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)
call for each iterated point

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