dmj5
Class DMJ_TrapTiling

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

class 
UserTransform:DMJ_TrapTiling

Provides useful tiling effects, primarily intended for use with trap shapes, but will work with anything.


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_TrapTiling(common.ulb:UserTransform) {
   ; Provides useful tiling effects, primarily intended for use with trap shapes, but will work with anything.
 
 public:
   import "common.ulb"
   
   func DMJ_TrapTiling(Generic pparent)
     UserTransform.UserTransform(pparent)
   endfunc
   
   complex func Iterate(complex pz)
     UserTransform.Iterate(pz)
     
     pz = (pz - @p_tilingcenter) * ((0,1) ^ (@p_tileangle / 90.0))  ; offset and rotate
     if (@p_tiletype == 0)      ; rectangular
       if (real(@p_tilespacing) != 0)
         pz = (real(pz) / real(@p_tilespacing) - round(real(pz) / real(@p_tilespacing))) * real(@p_tilespacing) + flip(imag(pz))
       endif
       if (imag(@p_tilespacing) != 0)
         pz = flip(imag(pz) / imag(@p_tilespacing) - round(imag(pz) / imag(@p_tilespacing))) * imag(@p_tilespacing) + real(pz)
       endif
 
     else
       pz = atan2(pz)*4/#pi + flip(cabs(pz))  ; convert
       if (real(@p_tilespacing) != 0)
         pz = (real(pz) / real(@p_tilespacing) - round(real(pz) / real(@p_tilespacing))) * real(@p_tilespacing) + flip(imag(pz))
       endif
       if (imag(@p_tilespacing) != 0)
         pz = flip(imag(pz) / imag(@p_tilespacing) - floor(imag(pz) / imag(@p_tilespacing))) * imag(@p_tilespacing) + real(pz)
       endif
     
       if (@p_tiletype == 2)  ; radial; convert back to rectangular
         pz = cos(real(pz)*#pi/4)*imag(pz) + flip(sin(real(pz)*#pi/4)*imag(pz))
       endif
     
     endif
     pz = (pz * ((0,1) ^ (-@p_tileangle / 90.0))) + @p_tilingcenter  ; un-rotate and un-offset
     
     return pz
   endfunc
   
 default:
   title = "Trap Tiling"
   
   int param v_dmj_traptiling
     caption = "Version (DMJ_TrapTiling)"
     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_traptiling < 100
   endparam
 
   int param p_tiletype
     caption = "Tile Type"
     default = 0
     enum = "rectangular" "polar" "radial"
     hint = "Selects the kind of tiling to use. 'Rectangular' provides simple grid tiling. 'Polar' will tile rectangularly, then treat the coordinates as polar coordinates. 'Radial' will tile radially around a central point."
   endparam
   complex param p_tilingcenter
     caption = "Tiling Center"
     default = (0,0)
     hint = "Sets the tiling center."
   endparam
   complex param p_tilespacing
     caption = "Tile Spacing"
     default = (1,1)
     hint = "Sets the tile spacing. For rectangular tiles, provides the width and height of the tiles. For polar and radial tiles, sets the angular distance and radial distance. For any of these, use a value of 0 to indicate no tiling in that direction."
   endparam
   float param p_tileangle
     caption = "Tile Rotation"
     default = 0
     hint = "Sets the angle of the tiling grid, in degrees."
   endparam
     
 }
 


Constructor Summary
DMJ_TrapTiling()
           
DMJ_TrapTiling(Generic pparent)
           
 
Method Summary
 complex Iterate(complex pz)
          Transform a single point within a sequence
 
Methods inherited from class common:Transform
Init, IsSolid, IterateSilent
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DMJ_TrapTiling

public DMJ_TrapTiling(Generic pparent)

DMJ_TrapTiling

public DMJ_TrapTiling()
Method Detail

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