rkb
Class RKB_TrapShapeFlower

Object
  extended by common:Generic
      extended by common:TrapShape
          extended by rkb:RKB_TrapShapeFlower

class 
TrapShape:RKB_TrapShapeFlower

An extended version of an n-leaved rose (pinch) shape - There are 60+ base shapes hard coded with the parameters being delta values from the base shapes.


Ultra Fractal Source

Toggle UF Source Code Display

 class RKB_TrapShapeFlower(common.ulb:TrapShape) {
 ; An extended version of an n-leaved rose (pinch) shape - There are
 ; 60+ base shapes hard coded with the parameters being delta values
 ; from the base shapes.
 public:
   func RKB_TrapShapeFlower(Generic pparent)
     TrapShape.TrapShape(pparent)
   ; True if function list is set to 'ident'
     bTwstF = (@funcTwist (1.5) == 1.5)
     bMF1   = (@funcShapeMod1(1.5) == 1.5)
     bMF2   = (@funcShapeMod2(1.5) == 1.5)
   endfunc
 
   float func Iterate(complex pz)
     float fTheta = atan2(pz)
     float fPointDist = cabs(pz)
 
     if fTheta < 0
       fTheta = fTheta + 2*#pi
     endif
 
 ; This is a chunk of old-style, precedural code in a
 ;  class wrapper.  I'm keeping it this way so that I
 ;  only have one body of code to maintain.
 ;------ Code shared with ucl ------
     ; --- Initialize default values ---
     float fLbs   = 0.0        ; Lobes
     float fTwst  = 0.0        ; Twist
     float fTwstF = fPointDist ; Twist Function
     float fBlg   = 1.0        ; Buldge
     float fThk   = 1.0        ; Lobe Thickness
     float fBlm   = 1.0        ; Bloom
     float fWF    = 0.0        ; Wave Frequency
     float fWA    = 0.0        ; Wave Amplitude
     float fWS    = 0.0        ; Wave Skew
     float fRF    = 0.0        ; Ridges Frequency
     float fRA    = 0.0        ; Ridges Amplitude
     float fOsc   = 0.0        ; Oscillator Frequency
     int   iMF1   = 0          ; Index for Mod Function 1
 
     float fO     = sin(fTheta*(@fOscFreq))
     float fMF1   = 1111.1     ; Mod Function 1 [HACK Alert]
     float fMF2   = fTheta     ; Mod Function 2
 
     ;--- Setup values for Predefined shapes.
     if    (@enShape == "Shape #0")
       fLbs = 4
     elseif (@enShape == "Shape #1: Null")
       if (@fLobes == 0), fLbs = 1.0,  endif ; Force at leaset one lobe
     elseif (@enShape == "Shape #2")
       fLbs = 3, fRF = 8, fRA = 1
     elseif (@enShape == "Shape #3")
       fLbs = 5, fThk = .2
     elseif (@enShape == "Shape #4")
       fLbs = 16, fThk = 5
     elseif (@enShape == "Shape #5")
       fLbs = 16, fThk = 5, iMF1 = 1
     elseif (@enShape == "Shape #6")
       fLbs = 16, fThk = 5, iMF1 = 2
     elseif (@enShape == "Shape #7")
       fLbs = 12, fThk = 5, iMF1 = 3
     elseif (@enShape == "Shape #8")
       fLbs = 6, fThk = 10, fRF = 12, fRA = 1
     elseif (@enShape == "Shape #9")
       fLbs = 5, fRF = 5, fRA = 3
     elseif (@enShape == "Shape #10")
       fLbs = 3, fThk = 4, fRF = 8, fRA = 2, fTwst = 1.8, iMF1 = 4
     elseif (@enShape == "Shape #11")
       fLbs = 3, fRF = 4, fRA = 15, fWF = 2, fWA = 4
     elseif (@enShape == "Shape #12")
       fLbs = 3, fBlm = .4, fRF = 4, fRA = 15, fWF = 2, fWA = 4, fTwst = .2, fOsc = 44, iMF1 = 3
     elseif (@enShape == "Shape #13")
       fLbs = 2, fBlm = 1.6, fBlg = .5, fTwst = 2, fTwstF = exp(fPointDist)
     elseif (@enShape == "Shape #14")
       fLbs = 24, fTwst = 1.5
     elseif (@enShape == "Shape #15")
       fLbs = 5, fThk = 3, fBlg = .8, iMF1 = 6
     elseif (@enShape == "Shape #16")
       fLbs = 3, fBlm = 3, fBlg = 2.4, fTwst = -2.3, fOsc = 3
     elseif (@enShape == "Shape #17")
       fLbs = 4, fThk = .1, fBlg=.5, iMF1 = 5
     elseif (@enShape == "Shape #18")
       fLbs = 2, fThk = 5, fBlg = .6, fTwst = 2.5, fTwstF = log(fPointDist), fRF = 12, fRA=4
     elseif (@enShape == "Shape #19")
       fLbs = 6, fMF2 = sqr(fTheta)
     elseif (@enShape == "Shape #20")
       fLbs = 20, fBlm = 2, fThk = 3.7, fBlg = 1.7, fRF = 12, fRA = 2
     elseif (@enShape == "Shape #21")
       fLbs = 16, fWF = 4, fWA = 4
     elseif (@enShape == "Shape #22")
       fLbs = 3, fBlg=-1, fTwst = 1.8, fRF=8, fRA=2, iMF1 = 1
     elseif (@enShape == "Shape #23")
       fLbs = 16, fBlg = .5, fTwst = 3
     elseif (@enShape == "Shape #24")
       fLbs = 32, fTwst = 1.5, fWF = 12, fWA=4, fOsc = 64
     elseif (@enShape == "Shape #25")
       fLbs = 3, fBlm = 3, fTwst = -2.3, fTwstF = sqr(fPointDist), fOsc = 3, fRF=12, fRA=4
     elseif (@enShape == "Shape #26")
       fLbs = 32, fBlg=.5
     elseif (@enShape == "Shape #27")
       fLbs = 3, fBlg=-1, fTwst = 1.8, fRF=8, fRA=2, iMF1 = 1, fMF2 = log(fTheta)
     elseif (@enShape == "Shape #28")
       fLbs = 16, fBlg = .5, fTwst = 3, fWF = 8, fWA = 12
     elseif (@enShape == "Shape #29")
       fLbs = 4, fTwst = 1.5, fWF = 12, fWA=4, fOsc = 64
     elseif (@enShape == "Shape #30")
       fLbs = 1, fTwst = 10, fBlg = .5, fBlm = 1.2
     elseif (@enShape == "Shape #31")
       fLbs = 16, fWF = 4, fWA = 4, fBlg = .47, iMF1 = 6
     elseif (@enShape == "Shape #32")
       fLbs = 5, fRF = 12, fRA = 2, fOsc = 5, iMF1 = 3
     elseif (@enShape == "Shape #33")
       fLbs = 32, fThk = 3, fBlg = 2, fTwst = .5, fTwstF = sqr(fPointDist), fWF = 4, fWA = 2, fOsc = 32, iMF1 = 8
     elseif (@enShape == "Shape #34")
       fLbs = 5, fTwst = .5, fTwstF = exp(fPointDist), fRF = 12, fRA = 2, fOsc = 5, iMF1 = 3, fWF = 2, fWA= 2
     elseif (@enShape == "Shape #35")
       fLbs = 2, fBlm = .6, fThk = .1, fBlg = 1.2, fTwst = 2.0, fTwstF = cotanh(fPointDist), fWF=3, fWA = 12, iMF1 = 1
     elseif (@enShape == "Shape #36")
       fLbs = 2, fThk = 5, fBlg = .6, fBlm = 1.5, fTwst = 2.5, fTwstF = log(fPointDist), fRF = 12, fRA=4, fWF = 22, fWA = 8
     elseif (@enShape == "Shape #37")
       fLbs = 5, fThk = 11, fBlg = .7, fRF = 4, fRA = 12
     elseif (@enShape == "Shape #38")
       fLbs = 32, fThk = 3, fBlg = 2, fTwst = 1, fTwstF = sqr(fPointDist), fRF = 8, fRA = 24, fOsc = 32, iMF1 = 8
     elseif (@enShape == "Shape #39")
       fLbs = 5, fRF = 12, fRA = 2, fOsc = 5, iMF1 = 7, fWF = 2, fWA= 2
     elseif (@enShape == "Shape #40")
       fLbs = 3, fBlm = 1.75, fTwst = 1, fTwstF = real(asin(fPointDist + flip(0))), fOsc = 44, iMF1 = 9
     elseif (@enShape == "Shape #41")
       fLbs = 5, fThk = 3, fBlm = 1.4, fBlg = .4, fTwst = -1, fMF2 = sin(fTheta), iMF1 = 10
     elseif (@enShape == "Shape #42")
       fLbs = 5, fThk = -2.5, fBlg = 0.5, fTwst = 3, fTwstF = sin(fPointDist), fRF = 11, fRA = 4, fWF = 4, fWA = 5
     elseif (@enShape == "Shape #43")
       fLbs = 32, fTwst = 1.5, fWF = 12, fWA=4
     elseif (@enShape == "Shape #44")
       fLbs = 6, fWA=4, iMF1 = 6, fMF2 = log(fTheta)
     elseif (@enShape == "Shape #45")
       fLbs = 3, fThk = -1.4, fTwst = 3, fTwstF = cotanh(fPointDist)
     elseif (@enShape == "Shape #46")
       fLbs = 2, fBlm = .6, fBlg = 1.8, fThk = -1.4, fTwst = 3, fTwstF = 0, fRF = 12, fRA=12
     elseif (@enShape == "Shape #47")
       fLbs = 2, fThk = -.01, fTwst = 3, fRF = 12, fRA=12
     elseif (@enShape == "Shape #48")
       fLbs = 3, fBlm = 10, fBlg = -2, fRF = 4, fRA = 4, fWF = 4, fWA = 4
     elseif (@enShape == "Shape #49")
       fLbs = 6, fWA=4, iMF1 = 6, fMF2 = log(fTheta), fTwst = 3
     elseif (@enShape == "Shape #50")
       fLbs = 2, fBlm = .6, fBlg = 1.8, fThk = -1.4, fTwst = 3, fOsc = 2, fRF = 12, fRA=10, fMF2 = cos(fTheta)
     elseif (@enShape == "Shape #51")
           fLbs = 3, fBlm = 1.5, fBlg = -.85, fTwst = 1, fRF = 4, fRA = 4, fWF = 4, fWA = 4, iMF1 = 1
     elseif (@enShape == "Shape #52")
            fLbs = 2.5, fRF = 4, fRA = 1, fMF2 = sqr(fTheta)
     elseif (@enShape == "Shape #53")
            fLbs = 6, fBlm = 24, fThk = .1, fBlg = 2, fTwst = 5, fTwstF = sin(fPointDist), fOsc = 6
     elseif (@enShape == "Shape #54")
       fLbs = 3, fThk = -1.4, fTwst = 3, fTwstF = atan(fPointDist), fOsc = 3
     elseif (@enShape == "Shape #55")
       fLbs = 6, fWA=4, iMF1 = 6, fMF2 = log(fTheta), fTwst = 3, fTwstF = cos(fPointDist)
     elseif (@enShape == "Shape #56")
       fLbs = 2, fBlm = .6, fBlg = 1.8, fThk = -1.4, fTwst = 3, fOsc = 2, fRF = 12, fRA=10, fMF2 = 0
     elseif (@enShape == "Shape #57")
       fLbs = 3, fBlm = 10, fBlg = -2, fRF = 4, fRA = 4, fWF = 4, fWA = 4, iMF1 = 1
     elseif (@enShape == "Shape #58")
       fLbs = 3,  fBlg = 2, fRF = 4, fRA = 11, fWF = 4, fWA = 22, fWS = -1
     elseif (@enShape == "Shape #59")
       fLbs = 3, fTwst = 1, fRF = 12, fRA = 4, fWF = 4, fWA = 22, fOsc = 3, iMF1 = 1
     elseif (@enShape == "Shape #60")
       fLbs = 4, fThk = .2, fBlm = 1.5, fWF = 5, fWA = 5, fWS = -1.5
     endif
 
     ; Avoid divide by zero
     if ((fBlm + @fBloom) == 0)
       fBlm = fBlm + .0001
     endif
 
     ; Shape mod 2
     if (bMF2)
       fTheta = fMF2
     else
       fTheta = real(@funcShapeMod2(fTheta))
     endif
 
     ; Twist function
     if (!bTwstF)
       fTwstF = real(@funcTwist(fPointDist))
     endif
 
     ;Twist
     fTheta = fTheta + fTwstF * (fTwst + @fTwist)
 
     if (fTheta < 0), fTheta = fTheta+2*#pi, endif
     if (fTheta > 2*#pi), fTheta = fTheta-2*#pi, endif
 
     ;Bulge
     float fPointDist = fPointDist^(@fBulge + fBlg)
 
     ;Waves
     fTheta = fTheta + (fWA + @fWaveAmp)/100*fPointDist^(fWS + @fWaveSkew)*real(sin(fPointDist*(fWF + @fWaveFreq)*2*#pi))
 
      ;Oscillator
     float fO = sin(fTheta*(fOsc + @fOscFreq))
 
     ; Shape mod 1
     if (!bMF1) ; Overriden
       if (fO > 0)
         fMF1 = real(@funcShapeMod1(abs(cos((fLbs + @fLobes)*fTheta*0.5))))
      else
         fMF1 = real(@funcShapeMod1(abs(sin((fLbs + @fLobes)*fTheta*0.5))))
       endif
     else ; Base shape
       if (fO > 0)
         float fT = abs(cos((fLbs + @fLobes)*fTheta*0.5))
       else
         float fT = abs(sin((fLbs + @fLobes)*fTheta*0.5))
       endif
       if (iMF1 == 0)     ; ident
         fMF1 = fT
       elseif (iMF1 == 1) ; exp
         fMF1 =  exp(fT)
       elseif (iMF1 == 2) ; acos
         fMF1 =  acos(fT)
       elseif (iMF1 == 3) ; atanh
         fMF1 =  atanh(fT)
       elseif (iMF1 == 4) ; log
         fMF1 =  log(fT)
       elseif (iMF1 == 5) ; cos
         fMF1 =  cos(fT)
       elseif (iMF1 == 6) ; asin
         fMF1 =  asin(fT)
       elseif (iMF1 == 7) ; cotanh
         fMF1 =  cotanh(fT)
       elseif (iMF1 == 8) ; recip
         fMF1 =  recip(fT)
       elseif (iMF1 == 9) ; tan
         fMF1 =  tan(fT)
       elseif (iMF1 == 10) ; sin
         fMF1 =  sin(fT)
       endif
     endif
 
     ; Calc shape
     float fIndex = real((((fPointDist)))) / fMF1^(1/(fThk + @fThick))/(fBlm + @fBloom)
 
     ; Ridges
     fIndex = fIndex - (fRA + @fRidgesAmp)/100*real(sin(fTheta*(fRF + @fRidgesFreq)*2*#pi))
 ;------ end shared ucl ------
 
     return fIndex
 
   endfunc
   
 private:
   ; True if function list is set to 'ident'
     bool bTwstF
     bool bMF1
     bool bMF2
 
 default:
   title = "Flower"
   param enShape
     caption = "Base Shapes"
     enum="Shape #0"    "Shape #1: Null"  "Shape #2"  "Shape #3"  "Shape #4"  \
          "Shape #5"    "Shape #6"  "Shape #7"  "Shape #8"  "Shape #9"  \
          "Shape #10"   "Shape #11" "Shape #12" "Shape #13" "Shape #14" \
          "Shape #15"   "Shape #16" "Shape #17" "Shape #18" "Shape #19" \
          "Shape #20"   "Shape #21" "Shape #22" "Shape #23" "Shape #24" \
          "Shape #25"   "Shape #26" "Shape #27" "Shape #28" "Shape #29" \
          "Shape #30"   "Shape #31" "Shape #32" "Shape #33" "Shape #34" \
          "Shape #35"   "Shape #36" "Shape #37" "Shape #38" "Shape #39" \
          "Shape #40"   "Shape #41" "Shape #42" "Shape #43" "Shape #44" \
          "Shape #45"   "Shape #46" "Shape #47" "Shape #48" "Shape #49" \
          "Shape #50"   "Shape #51" "Shape #52" "Shape #53" "Shape #54" \
          "Shape #55"   "Shape #56" "Shape #57" "Shape #58" "Shape #59" \
          "Shape #60"  ; "Shape #61" "Shape #62" "Shape #63" "Shape #64" \
 ;         "Shape #65"   "Shape #66" "Shape #67" "Shape #68" "Shape #69"
     default = 0
   endparam
   float param fLobes
     caption = "Lobes +/-"
     default = 0
     hint = "The number of 'petals' in the 'flower.'"
   endparam
   float param fThick
     Caption = "Lobe thickness +/-"
     default = 0.0
     hint="Varies the thickness of individual petals."
   endparam
   float param fBloom
     Caption = "Bloom  +/-"
     default = 0.0
     hint="Scales the shape sometimes revealing/expanding details."
   endparam
   float param fBulge
     Caption = "Bulge  +/-"
     default = 0.0
     hint = "Buldge out the shape."
   endparam
   float param fTwist
     caption = "Twist  +/-"
     default = 0
     hint = "Spirals the petals."
   endparam
   func funcTwist
     caption = "Twist function override"
     default = ident()
     hint="Varies the amount of twist by the function applied to the distance."
   endfunc
   float param fRidgesFreq
     Caption = "Ridges Frequency  +/-"
     default = 0.0
     hint = "Adds ridges/lines to the petals."
   endparam
   float param fRidgesAmp
     Caption = "Ridges Power +/-"
     default = 0.0
   endparam
   float param fWaveFreq
     Caption = "Waves Frequency  +/-"
     default = 0.0
     hint = "Adds waves to the petals."
   endparam
   float param fWaveAmp
     Caption = "Waves Power  +/-"
     default = 0.0
   endparam
   float param fWaveSkew
     Caption = "Wave Dist. Skew  +/-"
     default = 0.0
     hint="Skews waviness to the inside or outside of the flower."
   endparam
   float param fOscFreq
     Caption = "Oscillator Frequency  +/-"
     default = 0.0
     hint="Combines two out-of-phase versions of the flower.  Values equal to the \
     number of lobes and values in the range 40-200 are often interesting."
   endparam
   func funcShapeMod1
     caption = "Shape Modify 1 override."
     default = ident()
   endfunc
   func funcShapeMod2
     caption = "Shape Modify 2 override."
     default = ident()
   endfunc
   int param iVersion
     default = 1
     visible = false
   endparam
   
 }
 


Constructor Summary
RKB_TrapShapeFlower()
           
RKB_TrapShapeFlower(Generic pparent)
           
 
Method Summary
 float Iterate(complex pz)
          call this for each iteration being trapped
 
Methods inherited from class common:TrapShape
GetColorChannel, GetTextureValue, GetTransformedPoint, Init, IterateSilent, SetThreshold
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

RKB_TrapShapeFlower

public RKB_TrapShapeFlower(Generic pparent)

RKB_TrapShapeFlower

public RKB_TrapShapeFlower()
Method Detail

Iterate

public float Iterate(complex pz)
Description copied from class: TrapShape
call this for each iteration being trapped

Overrides:
Iterate in class TrapShape