rkb
Class RKB_TrapShapeCombineShapes

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

class 
TrapShape:RKB_TrapShapeCombineShapes

A shape plug-in which combines two shapes


Ultra Fractal Source

Toggle UF Source Code Display

 class RKB_TrapShapeCombineShapes(common.ulb:TrapShape) {
 ; A shape plug-in which combines two shapes
 public:
   func RKB_TrapShapeCombineShapes(Generic pparent)
     TrapShape(pparent)
   ; True if function list is set to 'ident'
     ShapeA = new @shapeA(this)
     ShapeB = new @shapeB(this)
   endfunc
   
   float func Iterate(complex pz)
 
     ; Process Shape A
     float fIndexA = ShapeA.Iterate(pz)
     if (@fGradientRotateA > 0.0)
       if (fIndexA > 1.0), fIndexA = 1.0, endif
       fIndexA = ((fIndexA + @fGradientRotateA) % 1.0)
     endif
     fIndexA = fIndexA * @fScaleA
 
     ; Process Shape B
     float fIndexB = ShapeB.Iterate(pz)
     if (@fGradientRotateB > 0.0)
       if (fIndexB > 1.0), fIndexB = 1.0, endif
       fIndexB = ((fIndexB + @fGradientRotateB) % 1.0)
     endif
    fIndexB = fIndexB * @fScaleB
     
     float fIndex = 0.0
 
     ; Put them together
     if (@enCombineMode == "Ratio")
       fIndex =  fIndexA * @fRatio + fIndexB * (1.0 - @fRatio)
     elseif (@enCombineMode == "A-B")
       fIndex = fIndexA - fIndexB
     elseif (@enCombineMode == "B-A")
       fIndex = fIndexB - fIndexA
     elseif (@enCombineMode == "A*B")
       fIndex = fIndexA * fIndexB
     elseif (@enCombineMode == "A/B")
       fIndex = fIndexB / (fIndexA * @fStrength)
     elseif (@enCombineMode == "min")
       if (fIndexA < fIndexB), fIndex = fIndexA, else, fIndex = fIndexB, endif
     elseif (@enCombineMode == "max")
       if (fIndexA > fIndexB), fIndex = fIndexA, else,  fIndex = fIndexB, endif
     elseif (@enCombineMode == "sin/cos")
       if (fIndexA > 1.0), fIndexA = 0.0, endif
       if (fIndexB > 1.0), fIndexB = 0.0, endif
       fIndex = (abs(sin(fIndexA * #pi)) + abs(cos(fIndexB * #pi)))/2
     elseif (@enCombineMode == "sin/cos min")
       if (fIndexA > 1.0), fIndexA = 0.0, endif
       if (fIndexB > 1.0), fIndexB = 0.0, endif
       fIndexA = abs(sin(fIndexA * #pi))
       fIndexB = abs(cos(fIndexB * #pi))
       if (fIndexA < fIndexB), fIndex = fIndexA, else, fIndex = fIndexB, endif
     elseif (@enCombineMode == "sin/cos max")
       if (fIndexA > 1.0), fIndexA = 0.0, endif
       if (fIndexB > 1.0), fIndexB = 0.0, endif
       fIndexA = abs(sin(fIndexA * #pi))
       fIndexB = abs(cos(fIndexB * #pi))
       if (fIndexA > fIndexB), fIndex = fIndexA, else, fIndex = fIndexB, endif
 
     elseif (@enCombineMode == "A only")
       fIndex = fIndexA
     elseif (@enCombineMode == "B only")
       fIndex = fIndexB
     endif
     return fIndex
   endfunc
 
 private:
   TrapShape ShapeA
   TrapShape ShapeB
 
 default:
   title = "Combine Shapes"
   int param iVersion
     default = 101
     visible = false
   endparam
   param enCombineMode
     caption = "Combine Mode"
     enum = "Ratio" "A-B" "B-A" "A*B" "A/B" "min" "max" "sin/cos" \
            "sin/cos min" "sin/cos max" "A only" "B only"
   endparam
   float param fRatio
     caption = "Combine Ratio"
     default = .5
     min = 0
     max = 1.0
     visible = @enCombineMode == "ratio"
   endparam
   float param fStrength
     caption = "Strength"
     default = .1
     visible = @enCombineMode == "A/B"
   endparam
   heading
     caption="-- Shape A parameters --"
   endheading
   float param fScaleA
     caption = "Scale Shape A"
     default = 1.0
   endparam
   float param fGradientRotateA
     caption = "Rotate Graident A"
     default = 0.0
     min = 0.0
     max = 1.0
     hint = "Rotates the gradient for Shape A.  Values range from 0.0 to 1.0."
 
   endparam
   TrapShape param shapeA
     caption = "Trap Shape A"
     default = RKB_TrapShapeFlower
     hint = "Selects first shape for the combination."
   endparam
   heading
     caption="-- Shape B parameters --"
   endheading
   float param fScaleB
     caption = "Scale Shape B"
     default = 1.0
   endparam
   float param fGradientRotateB
     caption = "Rotate Graident B"
     default = 0.0
     min = 0.0
     max = 1.0
     hint = "Rotates the gradient for Shape B.  Values range from 0.0 to 1.0."
   endparam
   TrapShape param shapeB
     caption = "Trap Shape B"
     default = RKB_TrapShapeFlower
     hint = "Selects second shape for the combination."
   endparam
 }
 


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

public RKB_TrapShapeCombineShapes(Generic pparent)

RKB_TrapShapeCombineShapes

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