reb
Class TobysMorph

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

class 
UserTransform:TobysMorph

A transform based upon the Morph code of Toby Marshall


Ultra Fractal Source

Toggle UF Source Code Display

 class TobysMorph(common.ulb:UserTransform) {
 ; A transform based upon the Morph code of Toby Marshall
   
 public:
   import "common.ulb"
   
 ; Constructor
   func TobysMorph(Generic pparent)
     UserTransform.UserTransform(pparent)
     z2m = 0
     z3 = 0
     z4  = 0
     pzp = 0
     pzq = 0
     qw = 0
     er = 0
     ty = 0
     nuvar = 0
   endfunc
 
 ; Transform a single point within a sequence  
   complex func Iterate(complex pz)
     UserTransform.Iterate(pz)
     if @tha2 == false
       qw = @nufunc(pz-@tw)^@exp3
       er = @nufunc2((pz-@tw2)^@exp1)
       ty = @nufunc3((pz-@tw3)^@exp2)
 
       if @change == "1"
         pz = @nufunc(pz-@tw)^@exp1
       elseif @change == "2"
         pz = qw+er
       elseif @change == "3"
         pz = qw-er
       elseif @change == "4"
         pz = qw*er
       elseif @change == "5"
         pz = qw/er
       elseif @change == "6"
         pz = qw^er
       elseif @change == "7"
         if @op == "+"
           pz = qw+(er+ty)
         elseif @op == "-"
           pz = qw+(er-ty)
         elseif @op == "*"
           pz = qw+(er*ty)
         elseif @op == "/"
           pz = qw+(er/ty)
         elseif @op == "^"
           pz = qw+(er^ty)
         endif
       elseif @change == "8"
         if @op == "+"
           pz = qw-(er+ty)
         elseif @op == "-"
           pz = qw-(er-ty)
         elseif @op == "*"
           pz = qw-(er*ty)
         elseif @op == "/"
           pz = qw-(er/ty)
         elseif @op == "^"
           pz = qw-(er^ty)
         endif
       elseif @change == "9"
         if @op == "+"
           pz = qw*(er+ty)
         elseif @op == "-"
           pz = qw*(er-ty)
         elseif @op == "*"
           pz = qw*(er*ty)
         elseif @op == "/"
           pz = qw*(er/ty)
         elseif @op == "^"
           pz = qw*(er^ty)
         endif
       elseif @change == "10"
         if @op == "+"
           pz = qw/(er+ty)
         elseif @op == "-"
           pz = qw/(er-ty)
         elseif @op == "*"
           pz = qw/(er*ty)
         elseif @op == "/"
           pz = qw/(er/ty)
         elseif @op == "^"
           pz = qw/(er^ty)
         endif
       elseif @change == "11"
         if @op == "+"
           pz = qw^(er+ty)
         elseif @op == "-"
           pz = qw^(er-ty)
         elseif @op == "*"
           pz = qw^(er*ty)
         elseif @op == "/"
           pz = qw^(er/ty)
         elseif @op == "^"
           pz = qw^(er^ty)
         endif
       endif
     else
       if @zchange1 == "|z|"
         z2m = |pz|
       elseif @zchange1 == "atan2(z)"
         z2m = atan2(pz)
       elseif @zchange1 == "real(z)"
         z2m = real(pz)
       elseif @zchange1 == "imag(z)"
         z2m = imag(pz)
       endif
 
       if @zchange2 == "|z|"
         z3 = |pz|
       elseif @zchange2 == "atan2(z)"
         z3 = atan2(pz)
       elseif @zchange2 == "real(z)"
         z3 = real(pz)
       elseif @zchange2 == "imag(z)"
         z3 = imag(pz)
       endif
 
       if @zchange3 == "|z|"
         z4 = |pz|
       elseif @zchange3 == "atan2(z)"
         z4 = atan2(pz)
       elseif @zchange3 == "real(z)"
         z4 = real(pz)
       elseif @zchange3 == "imag(z)"
         z4 = imag(pz)
       endif
 
       aa = @nufunc((pz-@tw)+@nufunc4(z2m-@tw4)^@exp4)
       bb = @nufunc((pz-@tw)-@nufunc4(z2m-@tw4)^@exp4)
       cc = @nufunc4((z2m-@tw4)^@exp4-@nufunc(pz-@tw))
       ff = real((z3-@tw5)^@exp5)
       dd = @nufunc5(ff)
       jj = (z4-@tw6)
       kk = (pz-@tw2)
       oo = (pz-@tw3)
       gg = @nufunc2(kk)
       hh = @nufunc6(jj)^@exp6
       ppp = @nufunc3(oo)
 
       if @mmode == "z+|z|"
         nuvar = aa
       elseif @mmode == "z-|z|"
         nuvar = bb
       elseif @mmode == "|z|-z"
         nuvar = cc
       endif
 
       if @change == "1"
         pz = nuvar^@exp1
       elseif @change == "2"
         if @mmode2 == "z+|z|"
           pz = nuvar^@exp3+@nufunc2(kk+dd)^@exp1
         elseif @mmode2 == "z-|z|"
           pz = nuvar^@exp3+@nufunc2(kk-dd)^@exp1
         elseif @mmode2 == "|z|-z"
           pz = nuvar^@exp3+@nufunc5(ff-gg)^@exp1
         elseif @mmode2 == "z*|z|"
           pz = nuvar^@exp3+@nufunc2(kk*dd)^@exp1
         elseif @mmode2 == "z/|z|"
           pz = nuvar^@exp3+@nufunc2(kk/dd)^@exp1
         elseif @mmode2 == "|z|/z"
           pz = nuvar^@exp3+@nufunc5(ff/gg)^@exp1
         endif
 
       elseif @change == "3"
         if @mmode2 == "z+|z|"
           pz = nuvar^@exp3-@nufunc2(kk+dd)^@exp1
         elseif @mmode2 == "z-|z|"
           pz = nuvar^@exp3-@nufunc2(kk-dd)^@exp1
         elseif @mmode2 == "|z|-z"
           pz = nuvar^@exp3-@nufunc5(ff-gg)^@exp1
         elseif @mmode2 == "z*|z|"
           pz = nuvar^@exp3-@nufunc2(kk*dd)^@exp1
         elseif @mmode2 == "z/|z|"
           pz = nuvar^@exp3-@nufunc2(kk/dd)^@exp1
         elseif @mmode2 == "|z|/z"
           pz = nuvar^@exp3-@nufunc5(ff/gg)^@exp1
         endif
 
      elseif @change == "4"
        if @mmode2 == "z+|z|"
          pz = nuvar^@exp3*@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pz = nuvar^@exp3*@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pz = nuvar^@exp3*@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pz = nuvar^@exp3*@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pz = nuvar^@exp3*@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pz = nuvar^@exp3*@nufunc5(ff/gg)^@exp1
        endif
 
      elseif @change == "5"
        if @mmode2 == "z+|z|"
          pz = nuvar^@exp3/@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pz = nuvar^@exp3/@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pz = nuvar^@exp3/@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pz = nuvar^@exp3/@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pz = nuvar^@exp3/@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pz = nuvar^@exp3/@nufunc5(ff/gg)^@exp1
        endif
 
      elseif @change == "6"
        if @mmode2 == "z+|z|"
          pz = nuvar^@exp3^@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pz = nuvar^@exp3^@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pz = nuvar^@exp3^@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pz = nuvar^@exp3^@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pz = nuvar^@exp3^@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pz = nuvar^@exp3^@nufunc5(ff/gg)^@exp1
        endif
 
      elseif @change == "7"
        if @mmode3 == "z+|z|"
          pzq = @nufunc3(oo+hh)^@exp2
        elseif @mmode3 == "z-|z|"
          pzq = @nufunc3(oo-hh)^@exp2
        elseif @mmode3 == "|z|-z"
          pzq = @nufunc6(jj^@exp6-ppp)^@exp2
        elseif @mmode3 == "z*|z|"
          pzq = @nufunc3(oo*hh)^@exp2
        elseif @mmode3 == "z/|z|"
          pzq = @nufunc3(oo/hh)^@exp2
        elseif @mmode3 == "|z|/z"
          pzq = @nufunc6(jj^@exp6/ppp)^@exp2
        endif
 
        if @mmode2 == "z+|z|"
          pzp =  nuvar^@exp3+@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pzp =  nuvar^@exp3+@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pzp =  nuvar^@exp3+@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pzp =  nuvar^@exp3+@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pzp =  nuvar^@exp3+@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pzp =  nuvar^@exp3+@nufunc5(ff/gg)^@exp1
        endif
 
        if @op == "+"
          pz = pzq + pzp
        elseif @op == "-"
          pz = pzq - pzp
        elseif @op == "*"
          pz = pzq * pzp
        elseif @op == "/"
          pz = pzq / pzp
        elseif @op == "^"
          pz = pzq ^ pzp
        endif
 
      elseif @change == "8"
        if @mmode3 == "z+|z|"
          pzq  =  @nufunc3(oo+hh)^@exp2
        elseif @mmode3 == "z-|z|"
          pzq = @nufunc3(oo-hh)^@exp2
        elseif @mmode3 == "|z|-z"
          pzq = @nufunc6(jj^@exp6-ppp)^@exp2
        elseif @mmode3 == "z*|z|"
          pzq = @nufunc3(oo*hh)^@exp2
        elseif @mmode3 == "z/|z|"
          pzq = @nufunc3(oo/hh)^@exp2
        elseif @mmode3 == "|z|/z"
          pzq = @nufunc6(jj^@exp6/ppp)^@exp2
        endif
 
        if @mmode2 == "z+|z|"
          pzp =  nuvar^@exp3-@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pzp =  nuvar^@exp3-@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pzp =  nuvar^@exp3-@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pzp =  nuvar^@exp3-@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pzp =  nuvar^@exp3-@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pzp =  nuvar^@exp3-@nufunc5(ff/gg)^@exp1
        endif
 
        if @op == "+"
          pz = pzq + pzp
        elseif @op == "-"
          pz = pzq - pzp
        elseif @op == "*"
          pz = pzq * pzp
        elseif @op == "/"
          pz = pzq / pzp
        elseif @op == "^"
          pz = pzq ^ pzp
        endif
 
      elseif @change == "9"
        if @mmode3 == "z+|z|"
          pzq  =  @nufunc3(oo+hh)^@exp2
        elseif @mmode3 == "z-|z|"
          pzq = @nufunc3(oo-hh)^@exp2
        elseif @mmode3 == "|z|-z"
          pzq = @nufunc6(jj^@exp6-ppp)^@exp2
        elseif @mmode3 == "z*|z|"
         pzq = @nufunc3(oo*hh)^@exp2
        elseif @mmode3 == "z/|z|"
          pzq = @nufunc3(oo/hh)^@exp2
        elseif @mmode3 == "|z|/z"
          pzq = @nufunc6(jj^@exp6/ppp)^@exp2
        endif
 
        if @mmode2 == "z+|z|"
          pzp =  nuvar^@exp3*@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pzp =  nuvar^@exp3*@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pzp =  nuvar^@exp3*@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pzp =  nuvar^@exp3*@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pzp =  nuvar^@exp3*@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pzp =  nuvar^@exp3*@nufunc5(ff/gg)^@exp1
        endif
 
        if @op == "+"
          pz = pzq + pzp
        elseif @op == "-"
          pz = pzq - pzp
        elseif @op == "*"
          pz = pzq * pzp
        elseif @op == "/"
          pz = pzq / pzp
        elseif @op == "^"
          pz = pzq ^ pzp
        endif
 
      elseif @change == "10"
        if @mmode3 == "z+|z|"
          pzq  =  @nufunc3(oo+hh)^@exp2
        elseif @mmode3 == "z-|z|"
          pzq = @nufunc3(oo-hh)^@exp2
        elseif @mmode3 == "|z|-z"
          pzq = @nufunc6(jj^@exp6-ppp)^@exp2
        elseif @mmode3 == "z*|z|"
          pzq = @nufunc3(oo*hh)^@exp2
        elseif @mmode3 == "z/|z|"
          pzq = @nufunc3(oo/hh)^@exp2
        elseif @mmode3 == "|z|/z"
          pzq = @nufunc6(jj^@exp6/ppp)^@exp2
        endif
 
        if @mmode2 == "z+|z|"
          pzp =  nuvar^@exp3/@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pzp =  nuvar^@exp3/@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pzp =  nuvar^@exp3/@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pzp =  nuvar^@exp3/@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pzp =  nuvar^@exp3/@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pzp =  nuvar^@exp3/@nufunc5(ff/gg)^@exp1
        endif
 
        if @op == "+"
          pz = pzq + pzp
        elseif @op == "-"
          pz = pzq - pzp
        elseif @op == "*"
          pz = pzq * pzp
        elseif @op == "/"
          pz = pzq / pzp
        elseif @op == "^"
          pz = pzq ^ pzp
        endif
 
     elseif @change == "11"
        if @mmode3 == "z+|z|"
          pzq  =  @nufunc3(oo+hh)^@exp2
        elseif @mmode3 == "z-|z|"
          pzq = @nufunc3(oo-hh)^@exp2
        elseif @mmode3 == "|z|-z"
          pzq = @nufunc6(jj^@exp6-ppp)^@exp2
        elseif @mmode3 == "z*|z|"
          pzq = @nufunc3(oo*hh)^@exp2
        elseif @mmode3 == "z/|z|"
          pzq = @nufunc3(oo/hh)^@exp2
        elseif @mmode3 == "|z|/z"
          pzq = @nufunc6(jj^@exp6/ppp)^@exp2
        endif
 
        if @mmode2 == "z+|z|"
          pzp =  nuvar^@exp3^@nufunc2(kk+dd)^@exp1
        elseif @mmode2 == "z-|z|"
          pzp =  nuvar^@exp3^@nufunc2(kk-dd)^@exp1
        elseif @mmode2 == "|z|-z"
          pzp =  nuvar^@exp3^@nufunc5(ff-gg)^@exp1
        elseif @mmode2 == "z*|z|"
          pzp =  nuvar^@exp3^@nufunc2(kk*dd)^@exp1
        elseif @mmode2 == "z/|z|"
          pzp =  nuvar^@exp3^@nufunc2(kk/dd)^@exp1
        elseif @mmode2 == "|z|/z"
          pzp =  nuvar^@exp3^@nufunc5(ff/gg)^@exp1
        endif
 
        if @op == "+"
          pz = pzq + pzp
        elseif @op == "-"
         pz = pzq - pzp
        elseif @op == "*"
          pz = pzq * pzp
        elseif @op == "/"
          pz = pzq / pzp
        elseif @op == "^"
          pz = pzq ^ pzp
        endif
      endif
     endif
     return pz
   endfunc
   
 protected:
   complex z2m
   complex z3
   complex z4
   complex pzp
   complex pzq
   complex qw
   complex er
   complex ty
   complex nuvar
 
 
 default:
   title = "Toby's Morph"
   int param v_tobysmorph
     caption = "Version (Toby's Morph)"
     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_tobysmorph < 101
   endparam
 
   param tha2
     caption = "Morph -> Morph II"
     default = false
   endparam
 
   param change
     caption = "Morph"
     enum = "1""2""3""4""5""6""7""8""9""10""11"
     default = 0
   endparam
 
   param mmode
     caption = "Z1 Mode"
     enum = "z+|z|""z-|z|""|z|-z"
     default = 0
     hint = "Defines relationship of z1 to z in 1st z block"
     visible = @tha2
   endparam
 
   param zchange1
     caption = "Z1 type"
     enum = "|z|""atan2(z)""real(z)""imag(z)"
     default = 0
     hint = "Determines the character of z1 variable "
     visible = @tha2
   endparam
 
   param mmode2
     caption = "Z2 Mode"
     enum = "z+|z|""z-|z|""|z|-z""z*|z|""z/|z|""|z|/z"
     default = 0
     hint = "Defines relationship of z2 to z in 2nd z block"
     visible = @tha2 && @change > 0
   endparam
 
   param zchange2
     caption = "Z2 type"
     enum = "|z|""atan2(z)""real(z)""imag(z)"
     default = 0
     hint = "Determines the character of z2 variable "
     visible = @tha2 && @change > 0
   endparam
 
   param mmode3
     caption = "Z3 Mode"
     enum = "z+|z|""z-|z|""|z|-z""z*|z|""z/|z|""|z|/z"
     default = 0
     hint = "Defines relationship of z3 to z in 3rd z block"
     visible = @tha2 && @change > 5
   endparam
 
    param zchange3
     caption = "Z3 type"
     enum = "|z|""atan2(z)""real(z)""imag(z)"
     hint = "Determines the character of z3 variable "
     default = 0
     visible = @tha2 && @change > 5
   endparam
 
   complex param exp1
     caption = "Bias 1"
     default = (1,0)
   endparam
 
   complex param exp3
     caption = "Bias 2"
     default = (1,0)
     visible = @change > 0
   endparam
 
   complex param exp2
     caption = "Bias 3"
     default = (1,0)
     visible = @change > 5
   endparam
 
   complex param exp4
     caption = "Bias Z1"
     default = (1,0)
     visible = @tha2
   endparam
 
   complex param exp5
     caption = "Bias Z2"
     default = (1,0)
     visible = @tha2 && @change > 0
   endparam
 
   complex param exp6
     caption = "Bias Z3"
     default = (1,0)
     visible = @tha2 && @change > 5
   endparam
 
   complex param tw
     caption = "Twist 1"
     default = (0,0)
   endparam
 
   complex param tw2
     caption = "Twist 2"
     default = (0,0)
     visible = @change > 0
   endparam
 
   complex param tw3
     caption = "Twist 3"
     default = (0,0)
     visible = @change > 5
   endparam
 
   complex param tw4
     caption = "Twist Z1"
     default = (0,0)
     visible = @tha2
   endparam
 
   complex param tw5
     caption = "Twist Z2"
     default = (0,0)
     visible = @tha2 && @change > 0
   endparam
 
   complex param tw6
     caption = "Twist Z3"
     default = (0,0)
     visible = @tha2 && @change > 5
   endparam
 
   param op
     caption = "Operator"
     enum = "+""-""*""/""^"
     default = 0
     visible = @change > 5
     endparam
 
   func nufunc
     caption = "Morph function 1"
     default = ident()
   endfunc
 
   func nufunc2
     caption = "Morph function 2"
     default = ident ()
     visible = @change > 0
   endfunc
 
   func nufunc3
     caption = "Morph function 3"
     default = ident ()
     visible = @change > 5
   endfunc
 
   func nufunc4
     caption = "Morph function Z1"
     default = ident ()
     visible = @tha2
   endfunc
 
   func nufunc5
     caption = "Morph function Z2"
     default = zero ()
     visible = @tha2 && @change > 0
   endfunc
 
   func nufunc6
     caption = "Morph function Z3"
     default = zero ()
     visible = @tha2 && @change > 5
   endfunc
 }
 


Constructor Summary
TobysMorph()
           
TobysMorph(Generic pparent)
          Constructor
 
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

TobysMorph

public TobysMorph(Generic pparent)
Constructor


TobysMorph

public TobysMorph()
Method Detail

Iterate

public complex Iterate(complex pz)
Transform a single point within a sequence

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