rkb
Class RKB_SSG

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

class 
TrapShape:RKB_SSG



Ultra Fractal Source

Toggle UF Source Code Display

 class RKB_SSG(common.ulb:TrapShape) {
 public:
   ; Constructor
   func RKB_SSG(Generic pparent)
     TrapShape.TrapShape(pparent)
     fMaxDist = 2
 
     ; Default setting for values
     a=0, b=0, m=0, n1=0, n2=0, n3=0
     fTw = 0  ; Twist
     fRA = 0  ; Ridges Amp
     fRF = 0  ; Ridges Freq
     fWA = 0  ; Waves Amp
     fWF = 0  ; Waves Freq
     fDP = 1  ; Vary wave by distance (Distance Power)
     s   = 1  ; Sweeps
 
     if (@enShape == "Shape #0")
       a=1, b=1.1, m=24, n1=1.7, n2=0.7, n3=6
     elseif (@enShape == "Shape #1: Null")
       ;Default params
     elseif (@enShape == "Shape #2")
       a=-2.6, b=1.1, m=8, n1=1.7, n2=0.7, n3=9.6
     elseif (@enShape == "Shape #3")
       a=24, b=1.1, m=16, n1=0.5,  n2=0.7, n3=0
     elseif (@enShape == "Shape #4")
       a=24, b=1.1, m=8, n1=0.5,  n2=0.7, n3=0
     elseif (@enShape == "Shape #5")
       a=1, b=1, m=7, n1=3,  n2=6, n3=6
     elseif (@enShape == "Shape #6")
       a=6.5, b=1.1, m=8, n1=0.5,  n2=0.7, n3=0.0
     elseif (@enShape == "Shape #7")
       a=5, b=1.1, m=8, n1=0.5,  n2=1.9, n3=0
     elseif (@enShape == "Shape #8")
       a=-1.3, b=1.1, m=8, n1=1.7,  n2=4, n3=0
     elseif (@enShape == "Shape #9")
       a=-5, b=1.1, m=10, n1=0.54,  n2=1, n3=0
     elseif (@enShape == "Shape #10")
       a=-5, b=1, m=10, n1=0.5,  n2=2, n3=0
     elseif (@enShape == "Shape #11")
       a=1, b=1, m=3, n1=5, n2=18, n3=18
     elseif (@enShape == "Shape #12")
       a=1, b=1, m=6, n1=20, n2=7, n3=18
     elseif (@enShape == "Shape #13")
       a=1, b=1, m=4, n1=2,  n2=1, n3=3
     elseif (@enShape == "Shape #14")
       a=1, b=1, m=8, n1=3,  n2=4, n3=17
     elseif (@enShape == "Shape #15")
       a=1, b=0.6, m=12, n1=32,  n2=1, n3=-11
     elseif (@enShape == "Shape #16")
       a=0.3, b=1.01, m=-8.1, n1=1,  n2=1, n3=150, s=6
     elseif (@enShape == "Shape #17")
       a=1, b=1, m=19, n1=9,  n2=14, n3=13
     elseif (@enShape == "Shape #18")
       a=1.5, b=2, m=8, n1=0.9,  n2=1.8, n3=0.8
     elseif (@enShape == "Shape #19")
       a=1.6, b=1, m=12, n1=1.5,  n2=2, n3=7.5
     elseif (@enShape == "Shape #20")
       a=2.7, b=2.6, m=6, n1=12,  n2=8.3, n3=5.3
     elseif (@enShape == "Shape #21")
       a=1.5, b=2, m=2, n1=1.7,  n2=0.7, n3=2
     elseif (@enShape == "Shape #22")
       a=1.19, b=2.8, m=32, n1=3,  n2=0.9, n3=6
     elseif (@enShape == "Shape #23")
       a=0.9, b=10, m=4, n1=4.2,  n2=17, n3=1.5
     elseif (@enShape == "Shape #24")
       a=1, b=1, m=3, n1=4.5,  n2=10, n3=10
     elseif (@enShape == "Shape #25")
       a=1, b=1, m=4, n1=12,  n2=15, n3=15
     elseif (@enShape == "Shape #26")
       a=1, b=1, m=7, n1=10,  n2=6, n3=6
     elseif (@enShape == "Shape #27")
       a=0.3, b=1, m=-8.5, n1=1,  n2=1, n3=140, s=4
     elseif (@enShape == "Shape #28")
       a=10, b=10, m=5, n1=1,  n2=7, n3=7
     elseif (@enShape == "Shape #29")
       a=1, b=1, m=12, n1=15,  n2=20, n3=3
     elseif (@enShape == "Shape #30")
       a=1, b=1, m=8, n1=1,  n2=1, n3=8
     elseif (@enShape == "Shape #31")
       a=0.3, b=1.01, m=-8.5, n1=1,  n2=1, n3=160, s=4
     elseif (@enShape == "Shape #32")
       a=1, b=1, m=5, n1=2,  n2=6, n3=6
     elseif (@enShape == "Shape #33")
       a=1, b=1, m=6, n1=1,  n2=1, n3=6
     elseif (@enShape == "Shape #34")
       a=1, b=1, m=3, n1=6,  n2=6, n3=6
     elseif (@enShape == "Shape #35")
       a=1, b=1, m=2, n1=1,  n2=1, n3=1
     elseif (@enShape == "Shape #36")
       a=1, b=1, m=2, n1=1,  n2=4, n3=8
     elseif (@enShape == "Shape #37")
       a=1, b=1, m=8, n1=7,  n2=8, n3=2
     elseif (@enShape == "Shape #38")
       a=1, b=1, m=1, n1=1,  n2=1, n3=1
     elseif (@enShape == "Shape #39")
       a=1, b=1, m=2, n1=1,  n2=1, n3=-1.27
     elseif (@enShape == "Shape #40")
       a=1, b=1, m=3, n1=1,  n2=1, n3=1
     elseif (@enShape == "Shape #41")
       a=1, b=1, m=4, n1=1,  n2=1, n3=1
     elseif (@enShape == "Shape #42")
       a=17, b=1, m=27.6, n1=24,  n2=2, n3=6, s=4
     elseif (@enShape == "Shape #43")
       a=1, b=1, m=6, n1=1,  n2=1, n3=1
     elseif (@enShape == "Shape #44")
       a=1, b=1, m=1, n1=0.3,  n2=0.3, n3=0.3
     elseif (@enShape == "Shape #45")
       a=1, b=1, m=2, n1=0.3,  n2=0.3, n3=0.3
     elseif (@enShape == "Shape #46")
       a=1, b=1, m=3, n1=0.3,  n2=0.3, n3=0.3
     elseif (@enShape == "Shape #47")
       a=1, b=1, m=4, n1=0.3,  n2=0.3, n3=0.3
     elseif (@enShape == "Shape #48")
       a=1.9, b=2.8, m=32, n1=3,  n2=0.9, n3=0.6
     elseif (@enShape == "Shape #49")
       a=1, b=0.85, m=2, n1=-3,  n2=1, n3=20
     elseif (@enShape == "Shape #50")
       a=1, b=0.85, m=22, n1=-0.11,  n2=0.9, n3=4
     elseif (@enShape == "Shape #51")
       a=0.4, b=0.85, m=22, n1=-0.11,  n2=0.9, n3=4
     elseif (@enShape == "Shape #52")
       a=1, b=1.2, m=24, n1=2,  n2=1, n3=4
     elseif (@enShape == "Shape #53")
       a=1, b=1.21, m=4, n1=-0.11,  n2=3.77, n3=0.77
     elseif (@enShape == "Shape #54")
       a=-1.15, b=1.21, m=4, n1=-0.11,  n2=3.77, n3=0.77
     elseif (@enShape == "Shape #55")
       a=1.2, b=1.1, m=16, n1=0.5,  n2=3.4, n3=0.9
     elseif (@enShape == "Shape #56")
       a=1.2, b=1.2, m=4, n1=0.5,  n2=3.5, n3=1
     elseif (@enShape == "Shape #57")
       a=1, b=1, m=22, n1=1, n2=1, n3=40
     elseif (@enShape == "Shape #58")
       a=1.2, b=-2, m=8, n1=0.5, n2=9, n3=1
     elseif (@enShape == "Shape #59")
       a=0.3, b=0.3, m=8, n1=0.3, n2=0.3, n3=0.6
     elseif (@enShape == "Shape #60")
       a=1, b=1, m=1, n1=1, n2=1, n3=40
     elseif (@enShape == "Shape #61")
       a=1.2, b=-2, m=4, n1=0.5, n2=9, n3=1
     elseif (@enShape == "Shape #62")
       a=1, b=-0.67, m=22, n1=1, n2=1, n3=40
     elseif (@enShape == "Shape #63")
       a=1, b=0.6, m=12, n1=32, n2=1, n3=40
     elseif (@enShape == "Shape #64")
       a=1, b=0.6, m=12, n1=32, n2=400, n3=40
     elseif (@enShape == "Shape #65")
       a=1, b=0.6, m=12, n1=32, n2=8, n3=-11
     elseif (@enShape == "Shape #66")
       a=17, b=1, m=27.6, n1=3, n2=2, n3=6, s=3
     elseif (@enShape == "Shape #67")
       a=1, b=0.6, m=12, n1=-400, n2=1, n3=270
     elseif (@enShape == "Shape #68")
       a=1.05, b=1.1, m=24, n1=0.4, n2=3.5, n3=0.87
     elseif (@enShape == "Shape #69")
       a=1.2, b=2, m=2, n1=2, n2=1.7, n3=6
     elseif (@enShape == "Shape #70")
       a=1.11, b=1.1, m=24, n1=0.4, n2=5, n3=1.12
     elseif (@enShape == "Shape #71")
       a=1.11, b=1.1, m=44, n1=1.1, n2=0.9, n3=0.3
     elseif (@enShape == "Shape #72")
       a=1, b=1.1, m=24, n1=0.4, n2=3.5, n3=0.87
     elseif (@enShape == "Shape #73")
       a=1, b=1.3, m=27.6, n1=3, n2=1, n3=6, s=3
     elseif (@enShape == "Shape #74")
       a=1, b=1.4, m=24.5, n1=3, n2=1, n3=6, s=4
     elseif (@enShape == "Shape #75")
       a=0.5, b=1.3, m=5.7, n1=1, n2=6, n3=2, s=4
     elseif (@enShape == "Shape #76")
       a=1.5, b=2, m=9.9, n1=1.8, n2=0.8, n3=4, s=4
     elseif (@enShape == "Shape #77")
       a=1, b=-0.67, m=22.3, n1=1, n2=1, n3=40, s=3
     elseif (@enShape == "Shape #78")
       a=-0.8, b=1.1, m=8, n1=1.7,  n2=4, n3=0
     elseif (@enShape == "Shape #79")
       a=1, b=1, m=3, n1=5, n2=18, n3=18, fTw=0.85, fRF=4, fRA=4
     elseif (@enShape == "Shape #80")
       a=0.3, b=1.01, m=-8.5, n1=1,  n2=1, n3=160, s=4, fWA=2, fWF=2
     elseif (@enShape == "Shape #81")
       a=24, b=1.1, m=16, n1=0.5,  n2=0.7, n3=0, fRF=9.696, fRA=3
     elseif (@enShape == "Shape #82")
       a=-4.22, b=1.1, m=10, n1=0.54, n2=.46, n3=7.6, fRF=22, fRA=1
     elseif (@enShape == "Shape #83")
       a=1, b=1, m=22, n1=2, n2=1, n3=40, fWF=2, fWA=2, fDP=-2
     elseif (@enShape == "Shape #84")
       a=0.3, b=1.01, m=-5.85, n1=1,  n2=1, n3=150, s=6, fWF=2, fWA=2
     elseif (@enShape == "Shape #85")
       a=0.03, b=2, m=2, n1=1.7,  n2=0.7, n3=2, fWF=2, fWA=4
     elseif (@enShape == "Shape #86")
       a=1.6, b=10, m=4, n1=4.2,  n2=17, n3=1.5, fTw=1.7
     elseif (@enShape == "Shape #87")
       a=1, b=1.1, m=8, n1=0.4, n2=0.7, n3=6
     elseif (@enShape == "Shape #88")
       a=17, b=0.64, m=27.6, n1=24,  n2=2, n3=6, s=4
     elseif (@enShape == "Shape #89")
       a=1.2, b=-2, m=8, n1=0.5, n2=9, n3=1, fRF=5.25, fRA=6
     elseif (@enShape == "Shape #90")
       a=1, b=1.21, m=4, n1=-0.11,  n2=3.77, n3=2, fTw=1.6
     elseif (@enShape == "Shape #91")
       a=1, b=1, m=20, n1=1, n2=1, n3=40, fWF=4.0, fWA=4.0, fDP=-1.5
     elseif (@enShape == "Shape #92")
       a=1, b=0.6, m=10, n1=32, n2=1, n3=40, fTw=1
     elseif (@enShape == "Shape #93")
       a=1, b=0.6, m=12, n1=32, n2=8, n3=-11, fRF=11, fRA=2
     elseif (@enShape == "Shape #94")
       a=1, b=0.6, m=12, n1=-400, n2=1, n3=270, fRF=11, fRA=1, fWF=4, fWA=1, fDP=-2
     elseif (@enShape == "Shape #95")
       a=0.5, b=1.3, m=5.7, n1=-1.4, n2=6, n3=2, s=4, fWF=-4, fWA=3, fDP=-2
     elseif (@enShape == "Shape #96")
       a=1, b=0.6, m=10, n1=32,  n2=1, n3=-11, fRF=11, fRA=0.5
     elseif (@enShape == "Shape #97")
       a=2.1, b=2, m=8, n1=0.9,  n2=1.8, n3=0.8, fRF=2.58, fRA=6
     elseif (@enShape == "Shape #98")
       a=1, b=1, m=3, n1=4.5,  n2=10, n3=10, fTw=1.6, fRF=2.55, fRA=1
     elseif (@enShape == "Shape #99")
       a=1, b=1.07, m=22, n1=-0.11,  n2=0.9, n3=4, fTw=-0.65, fWF=2.0, fWA=6.0
      endif
 
     a=a+@a, b=b+@b, m=m+@m, n1=n1+@n1, n2=n2+@n2, n3=n3+@n3
     s = s+@iSweeps
 
     fTw = fTw + @fTwist
     fRA = fRA + @fRidgesAmp
     fRF = fRF + @fRidgesFreq
     fWA = fWA + @fWaveAmp
     fWF = fWF + @fWaveFreq
     fDP = fDP + @fDistPower
     
     fInc = #pi/180 ; 360 tests
     fRMin =  999999999
     fRMax = -999999999
     
     ; Figure out maximum size (with some certainty)
     float fEnd = #pi*2
     while (fEnd > 0)
       float rr
       rr = (abs((cos(m * fEnd/4)/a)^n2) + ((abs(sin(m * fEnd/4)/b))^n3))^(-1.0/n1)
       if (rr > fRMax), fRMax = rr, endif
       if (rr < fRMin), fRMin = rr, endif
       fEnd = fEnd - fInc
     endwhile
   endfunc
 
   float func Iterate(complex pz)
     float x = real(pz)
     float y = (imag(pz))*@fStretchXY
 
     float fTheta = atan(y/x)+@fRotation
 
     if (x < 0.0), fTheta = fTheta + #pi, endif
 
     if (fTheta == 0), fTheta = .001, endif
 
     fTheta = real(@funcShapeMod1(fTheta))
 
     float fPointDist = sqrt(x^2 + y^2)
 
     ;Twist
     fTheta = fTheta + real(@funcTwist(fPointDist)) * fTw
 
     ;Waves
     float fDistMult = fPointDist^fDP
     fTheta = fTheta + fWA/100*fDistMult*real(sin(fPointDist*fWF*2*#pi))
 
     float rT
     float r =  -999999999
     int i = 1
     while (i <= s)
       i = i+1
       rT = (abs((cos(m * real(@funcShapeMod2(fTheta))/4)/a)^n2) + ((abs(sin(m * real(@funcShapeMod2(fTheta))/4)/b))^n3))^(-1/n1)
       if (rT > r), r = rT, endif
       fTheta = fTheta + 2*#pi
     endwhile
 
     float fIndex = (fPointDist/((r)*(fMaxDist/fRMax)))/@fScale
 
     ; Ridges
     fIndex = fIndex - fRA/100*real(sin(fTheta*fRF*2*#pi))
 
     return fIndex
   endfunc
 
 private:
     float a
     float b
     float m
     float n1
     float n2
     float n3
     float fTw  ; Twist
     float fRA  ; Ridges Amp
     float fRF  ; Ridges Freq
     float fWA  ; Waves Amp
     float fWF  ; Waves Freq
     float fDP  ; Vary wave by distance (Distance Power)
     int   s    ; Sweeps
     float fMaxDist
     float fInc
     float fRMin
     float fRMax
 
 default:
   title = "SSG"
   int param iVersion
     default = 1
     visible = false
   endparam
   heading
     Caption="Shape Parameters"
    endheading
   param enShape
     caption = "Base Shape"
     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" \
          "Shape #70"   "Shape #71" "Shape #72" "Shape #73" "Shape #74" \
          "Shape #75"   "Shape #76" "Shape #77" "Shape #78" "Shape #79" \
          "Shape #80"   "Shape #81" "Shape #82" "Shape #83" "Shape #84" \
          "Shape #85"   "Shape #86" "Shape #87" "Shape #88" "Shape #89" \
          "Shape #90"   "Shape #91" "Shape #92" "Shape #93" "Shape #94" \
          "Shape #95"   "Shape #96" "Shape #97" "Shape #98" "Shape #99"
     default = 0
   endparam
   float param a
     caption="a +/-"
     default =  0
   endparam
   float param b
     caption="b +/-"
     default = 0
   endparam
   float param m
     caption="m +/-"
     default = 0
     hint="Increasing value tends to increase the number of 'arms' or 'lobes' in the shape."
   endparam
   float param n1
     caption="n1 +/-"
     default = 0
   endparam
   float param n2
     caption="n2 +/-"
     default = 0
   endparam
   float param n3
     caption="n3 +/-"
     default = 0
   endparam
   int param iSweeps
     Caption="Sweeps"
     default = 0
     min=0
     max=100
   endparam
   heading
     Caption="Shape Modifiers"
   endheading
   float param fStretchXY
     Caption = "Stretch (X/Y)"
     default = 1.0
     hint="Changes the aspect ratio of the shape."
   endparam
   float param fRotation
     Caption = "Rotation (Radians)"
     default = 0
     hint="Rotates the shape from -2*pi to 2*pi degrees"
     max =  6.283
     min = -6.283
   endparam
   float param fScale
     Caption = "Scale"
     default = 1.0
     hint="Scales the shape"
     min = .00001
   endparam
   float param fTwist
     Caption = "Twist +/-"
     default = 0.0
     hint="Twists the shape"
   endparam
   func funcTwist
     caption = "Twist Function"
     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
   endparam
   float param fRidgesAmp
     Caption = "Ridges Amplitude  +/-"
     default = 0
   endparam
   float param fWaveFreq
     Caption = "Waves Frequency  +/-"
     default = 0
   endparam
   float param fWaveAmp
     Caption = "Waves Amplitude  +/-"
     default = 0
   endparam
   float param fDistPower
     Caption = "Vary Wave by Distance +/-"
     default = 0.0
     hint="The higher the value, the less waviness in the center of the flower.  \
     Negative values push the waviness to the center"
   endparam
   func funcShapeMod1
     caption = "Shape Modify 1"
     default = ident()
   endfunc
   func funcShapeMod2
     caption = "Shape Modify 2"
     default = ident()
   endfunc
 
 }
 


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

public RKB_SSG(Generic pparent)
Constructor


RKB_SSG

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