Standard
Class Standard_Kaleidoscope

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UserTransform
              extended by Standard:Standard_Kaleidoscope

class 
UserTransform:Standard_Kaleidoscope

Object version of Kaleidoscope in Standard.uxf. Kaleidoscope transformation. Can be used to simulate many different kinds of symmetry. Originally written by Damien M. Jones.


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_Kaleidoscope(common.ulb:UserTransform) {
 ;
 ; Object version of Kaleidoscope in Standard.uxf.
 ;
 ; Kaleidoscope transformation. Can be used to simulate many different kinds
 ; of symmetry.
 ;
 ; Originally written by Damien M. Jones.
 ;
 public:
   complex func Iterate(complex pz)
     float r2 = 0.0
     float d = 0.0
     complex r = (0,1) ^ (@angle/90)  ; complex rotation vector
     complex c = @symcenter    ; assume symmetry center is fixed
     IF (@centermove)      ; relative symmetry center requested
       c = #center        ; symmetry center is image center
     ENDIF
     complex z2 = pz - c    ; get coordinate relative to symcenter
 
     ; convert z2 into angle and distance
     r2 = atan2(z2)
     IF (r2 < 0); negative angle (we want 0 < atan < pi*2)
       r2 = r2 + #pi * 2; rotate 360 degrees
     ENDIF
     d = cabs(z2)        ; distance from symcenter
 
     IF (@symorder > 0)      ; Zero symmetry disables the transform.
       ; apply symmetry
       IF (@symreflect == 0)    ; reflective
         r2 = r2 - floor(r2*@symorder/#pi/2)*#pi*2/@symorder
         IF (r2 > #pi/@symorder)    ; upper half of the range
           r2 = #pi*2/@symorder - r2  ; reflect angle
         ENDIF
       ELSEIF (@symreflect == 1)    ; left symmetry
         r2 = r2 - floor(r2*@symorder/#pi/2)*#pi*2/@symorder
       ELSEIF (@symreflect == 2)    ; right symmetry
         r2 = r2 - floor(r2*@symorder/#pi/2)*#pi*2/@symorder
         r2 = #pi*2/@symorder - r2    ; always reflect this
       ELSEIF (@symreflect == 3)    ; slice-only symmetry
         IF (r2 > #pi*2/@symorder)    ; outside of slice
           r2 = 0        ; reset angle
           m_Solid = true
         ENDIF
       ENDIF
       return (cos(r2)*d + flip(sin(r2)*d))/r + c  ; compute point
     else
       return pz
     ENDIF
   endfunc
 
 default:
   title = "Kaleidoscope"
   helpfile = "Uf*.chm"
   helptopic = "Html/transformations/standard/kaleidoscope.html"
   param symorder
     caption = "Symmetry Order"
     default = 8.0
     hint = "Indicates the number of reflected components. \
             Use 0 to temporarily disable symmetry."
   endparam
   param symreflect
     caption = "Symmetry Mode"
     default = 0
     enum = "reflective" "left" "right" "slice only"
     hint = "Style of symmetry.  Reflective will always be \
             seamless; left and right may not be.  If Slice \
       is selected, only the section that will be \
       mirrored will be shown."
   endparam
   complex param symcenter
     caption = "Center"
     default = #center
     enabled = !@centermove
     hint = "Sets the center of symmetry.  If Use Screen \
             Center is set, this item is ignored."
   endparam
   param centermove
     caption = "Use Screen Center"
     default = false
     hint = "If set, symmetry will be around the center of \
             the window, regardless of the Symmetry Center \
       setting."
   endparam
   param angle
     caption = "Rotation angle"
     default = 0.0
     hint = "Sets how much to rotate the fractal (in degrees) \
             before applying symmetry. Can be used to select \
             a slice of the fractal."
   endparam
 }
 


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

Standard_Kaleidoscope

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