jlb
Class JLB_SpiroGlyphicUtilityTransform

Object
  extended by common:Generic
      extended by common:Transform
          extended by common:UtilityTransform
              extended by jlb:JLB_SpiroGlyphicUtilityTransform

class 
UtilityTransform:JLB_SpiroGlyphicUtilityTransform

Part of the Spiroglyphics formula, as in tma2.ufm, as a Transform.


Ultra Fractal Source

Toggle UF Source Code Display

 class JLB_SpiroGlyphicUtilityTransform(common.ulb:UtilityTransform) {
 ; Part of the Spiroglyphics formula, as in tma2.ufm, as a Transform.
 public:
 
   func JLB_SpiroGlyphicUtilityTransform(Generic pparent)
     UtilityTransform.UtilityTransform(pparent)
   endfunc
 
   func Init(complex pz)
     if @op1 == "++++"
        m1=+1, m2=+1, m3=+1, m4=+1
      elseif @op1 == "+++-"
        m1=+1, m2=+1, m3=+1, m4=-1
      elseif @op1 == "++-+"
        m1=+1, m2=+1, m3=-1, m4=+1
      elseif @op1 == "+-++"
        m1=+1, m2=-1, m3=+1, m4=+1
      elseif @op1 == "-+++"
        m1=-1, m2=+1, m3=+1, m4=+1
      elseif @op1 == "++--"
        m1=+1, m2=+1, m3=-1, m4=-1
      elseif @op1 == "+--+"
        m1=+1, m2=-1, m3=-1, m4=+1
      elseif @op1 == "--++"
        m1=-1, m2=-1, m3=+1, m4=+1
      elseif @op1 == "-++-"
        m1=-1, m2=+1, m3=+1, m4=-1
      elseif @op1 == "+-+-"
        m1=+1, m2=-1, m3=+1, m4=-1
      elseif @op1 == "-+-+"
        m1=-1, m2=+1, m3=-1, m4=+1
      elseif @op1 == "+---"
        m1=+1, m2=-1, m3=-1, m4=+1
      elseif @op1 == "-+--"
        m1=-1, m2=+1, m3=-1, m4=-1
      elseif @op1 == "--+-"
        m1=-1, m2=-1, m3=+1, m4=-1
      elseif @op1 == "---+"
        m1=-1, m2=-1, m3=-1, m4=+1
      else;if @op1 == "----"
        m1=-1, m2=-1, m3=-1, m4=-1
      endif
      if @op2 == "++++"
        n1=+1, n2=+1, n3=+1, n4=+1
      elseif @op2 == "+++-"
        n1=+1, n2=+1, n3=+1, n4=-1
      elseif @op2 == "++-+"
        n1=+1, n2=+1, n3=-1, n4=+1
      elseif @op2 == "+-++"
        n1=+1, n2=-1, n3=+1, n4=+1
      elseif @op2 == "-+++"
        n1=-1, n2=+1, n3=+1, n4=+1
      elseif @op2 == "++--"
        n1=+1, n2=+1, n3=-1, n4=-1
      elseif @op2 == "+--+"
        n1=+1, n2=-1, n3=-1, n4=+1
      elseif @op2 == "--++"
        n1=-1, n2=-1, n3=+1, n4=+1
      elseif @op2 == "-++-"
        n1=-1, n2=+1, n3=+1, n4=-1
      elseif @op2 == "+-+-"
        n1=+1, n2=-1, n3=+1, n4=-1
      elseif @op2 == "-+-+"
        n1=-1, n2=+1, n3=-1, n4=+1
      elseif @op2 == "+---"
        n1=+1, n2=-1, n3=-1, n4=+1
      elseif @op2 == "-+--"
        n1=-1, n2=+1, n3=-1, n4=-1
      elseif @op2 == "--+-"
        n1=-1, n2=-1, n3=+1, n4=-1
      elseif @op2 == "---+"
        n1=-1, n2=-1, n3=-1, n4=+1
      else;if @op2 == "----"
        n1=-1, n2=-1, n3=-1, n4=-1
      endif
   endfunc
 
   ; @param pz
   ; @return the new pz
   complex func Iterate(complex pz)
     complex x = real(@fnx(pz)) + flip(real(@start/10))
     complex y = imag(@fny(pz)) + flip(imag(@start/10))
     complex newx = y
     complex newy = x
     int i = 0
 
     if @chain == "Separate"
       while i < @flavor
         i = i + 1
         newx = y + m1*real(@h2a/10)*@fn1(@a1 * newx) + \
           m2*imag(@h2a/10)*@fn3(@a2 * newx)
         newy = x + m3*real(@h2b/10)*@fn2(@a3 * newy) + \
            m4 *imag(@h2b/10)*@fn4(@a4 * newy)
       endwhile
       x = x + n1*real(@h1a/10)*@fn5(newx) + n2*imag(@h1a/10)*@fn7(newx)
       y = y + n3*real(@h1b/10)*@fn6(newy) + n4*imag(@h1b/10)*@fn8(newy)
     elseif @chain == "Ganged"
       while i < @flavor
         i = i + 1
         newx = y + m1*real(@h2/10)*@fn1(@a1 * newx) + \
           m2*imag(@h2/10)*@fn3(@a2 * newx)
         newy = x + m3*real(@h2/10)*@fn2(@a3 * newy) +  \
           m4*imag(@h2/10)*@fn4(@a4 * newy)
       endwhile
       x = x + n1*real(@h1/10)*@fn5(newx) + n2*imag(@h1/10)*@fn7(newx)
       y = y + n3*real(@h1/10)*@fn6(newy) + n4*imag(@h1/10)*@fn8(newy)
     endif
 
     if @op == "x+y"
       pz = @fna(x) + flip(@fnb(y))
     elseif @op == "x-y"
       pz = @fna(x)- flip(@fnb(y))
     else;if @op == "y-x"
       pz = flip(@fnb(y)) - @fna(x)
     endif
 
     return pz
   endfunc
 
 protected:
   int m1, int m2, int m3, int m4
   int n1, int n2, int n3, int n4
 
 default:
   title = "Spiroglyphic"
   int param v_SpiroglyphicUtilitytransform
     caption = "Version (SpiroglyphicUtilityTransform)"
     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_SpiroglyphicUtilitytransform < 100
   endparam
   int param chain
     caption = "Intensity Mode"
     enum = "Separate" "Ganged"
     default = 0
     hint = "Choose whether X/Y intensity and step sizes vary together \
             or separately"
   endparam
 
   complex param h1a
     caption = "Intensity X"
     default = (.1,.1)
     visible = @chain == 0
   endparam
 
   complex param h1b
     caption = "Intensity Y"
     default = (.1,.1)
     visible = @chain == 0
   endparam
 
   complex param h2a
     caption = "Step Size X"
     default = (.8,.8)
     visible = @chain == 0 && (@h1a != (0,0) || @h1b != (0,0))
   endparam
 
   complex param h2b
     caption = "Step Size Y"
     default = (.8,.8)
     visible = @chain == 0 && (@h1a != (0,0) || @h1b != (0,0))
   endparam
 
   complex param h1
     caption = "Intensity X/Y"
     default = (.1, .1)
     visible = @chain == 1
   endparam
 
   complex param h2
     caption = "Step Size X/Y"
     default = (.8,.8)
     visible = @chain == 1 && @h1 != (0,0)
   endparam
 
   complex param start
     caption = "Glyph Start"
     default = (0,0)
   endparam
 
   int param flavor
     caption = "Flavor"
     default = 2
     min = 0
     hint = "This is an integer param which works in steps. Higher \
            numbers generally create more intense effects"
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   float param a1
     caption = "Alpha 1"
     default = 2.7
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   float param a2
     caption = "Alpha 2"
     default = 2.7
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   float param a3
     caption = "Alpha 3"
     default = 2.7
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   float param a4
     caption = "Alpha 4"
     default = 2.7
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   param op
     caption = "Main Operator"
     enum = "x+y" "x-y" "y-x"
     default = 0
   endparam
 
   param op1
     caption = "Operator 1"
     enum = "++++" "+++-" "++-+" "+-++" "-+++" "++--" "+--+" "--++" \
            "-++-" "+-+-" "-+-+" "+---" "-+--" "--+-" "---+" "----"
     default = 0
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   param op2
     caption = "Operator 2"
     enum = "++++" "+++-" "++-+" "+-++" "-+++" "++--" "+--+" "--++" \
            "-++-" "+-+-" "-+-+" "+---" "-+--" "--+-" "---+" "----"
     default = 7
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endparam
 
   func fn1
     caption = "Function 1"
     default = sin()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn2
     caption = "Function 2"
     default = sin()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn3
     caption = "Function 3"
     default = cos()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn4
     caption = "Function 4"
     default = cos()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn5
     caption = "Function 5"
     default = sin()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn6
     caption = "Function 6"
     default = sin()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn7
     caption = "Function 7"
     default = cos()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fn8
     caption = "Function 8"
     default = cos()
     visible = (@chain == 0 && @h1a != (0,0) || @h1b != (0,0) ) || \
               (@chain == 1 && @h1 != (0,0))
   endfunc
 
   func fna
     caption = "Initial X Fn"
     default = ident()
   endfunc
 
   func fnb
     caption = "Initial Y Fn"
     default = ident()
   endfunc
 
   func fnx
     caption = "Global X Fn"
     default = ident()
   endfunc
 
   func fny
     caption = "Global Y Fn"
     default = ident()
   endfunc
 }
 


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

JLB_SpiroGlyphicUtilityTransform

public JLB_SpiroGlyphicUtilityTransform(Generic pparent)

JLB_SpiroGlyphicUtilityTransform

public JLB_SpiroGlyphicUtilityTransform()
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 -
Returns:
the new pz