dmj5
Class DMJ_OrbitTrapsColoring

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:GradientColoring
              extended by dmj5:DMJ_OrbitTrapsColoring

class 
GradientColoring:DMJ_OrbitTrapsColoring

...need details...


Ultra Fractal Source

Toggle UF Source Code Display

 class DMJ_OrbitTrapsColoring(common.ulb:GradientColoring) {
   ;
   ; ...need details...
   ;
 
 public:
   import "common.ulb"
 
   func DMJ_OrbitTrapsColoring(Generic pparent)
     GradientColoring.GradientColoring(pparent)
     
     m_TrapSelect = new @f_trapselect(this)
     m_TrapTransform = new @f_traptransform(this)
     m_TrapShape = new @f_trapshape(this)
     m_TrapTransfer = new @f_traptransfer(this)
     m_TrapMode = new @f_trapmode(this)
     m_TrapTexture = new @f_traptexture(this)
     m_TrapColoring = new @f_trapcoloring(this)
     
     m_TrapShape.SetThreshold(@p_threshold)
     m_TrapMode.SetThreshold(@p_threshold)
   endfunc
   
   func Init(complex pz, complex ppixel)
     GradientColoring.Init(pz, ppixel)
     
     m_TrapSelectSequence = m_TrapSelect.InitDefault()
     m_TrapTransform.Init(pz)
     m_TrapShape.Init(pz)
     m_TrapTransfer.Init(pz)
     m_TrapMode.Init(pz)
     m_TrapTexture.Init(pz)
   endfunc
   
   func Iterate(complex pz)
     GradientColoring.Iterate(pz)
     
     ; OVERVIEW
     ; decide whether to test this iteration
       ; for each trap
         ; update any incremental values for this trap
         ; get coordinate from #z or from previous trap transformations
         ; transform trap
           ; apply fBm distortion to trap
           ; radially repeat trap shape
           ; grid repeat trap shape
           ; quantize trap shape
           ; rotate trap shape
           ; apply trap aspect ratio
           ; skew trap
         ; determine distance to trap
           ; use different method for each shape
           ; apply diameter(s) to trap
           ; apply fBm texturizing to trap (before add)
           ; apply fade add/multiply
           ; apply fBm texturizing to trap (after add)
           ; apply trap transfer function
           ; apply fBm texturizing to trap (after transfer)
           ; eliminate negative distances
           ; compute and save fBm "color" for this coordinate
       ; combine trap distances
         ; for each trap
           ; apply trap weight function
         ; merge traps
       ; apply trap merge to update internal counters
 
     m_TrapSelectSequence = m_TrapSelect.Iterate(m_TrapSelectSequence)
     if ((@f_trapselect == DMJ_TrapSelect && m_TrapSelectSequence > 0.5) || m_TrapSelectSequence > @p_trapselectthreshold)
       complex zt = m_TrapTransform.Iterate(pz)
       float distance = m_TrapShape.Iterate(zt)
       distance = m_TrapTransfer.Iterate(distance)
       zt = m_TrapShape.GetTransformedPoint()
       float texture = m_TrapShape.GetTextureValue()
       if (@p_textureposttransform)
         texture = texture + m_TrapTexture.Iterate(zt)
       else
         texture = texture + m_TrapTexture.Iterate(pz)
       endif
       texture = (texture + m_TrapTexture.GetTextureValue()) * @p_texturestrength
       if (!m_TrapTransform.IsSolid())
         m_TrapMode.Iterate(pz, zt, distance, texture)
       else
         m_TrapMode.IterateSilent()
       endif
 
     else
       m_TrapTransform.IterateSilent()
       m_TrapShape.IterateSilent()
       m_TrapTransfer.IterateSilent()
       m_TrapMode.IterateSilent()
       m_TrapTexture.IterateSilent()
     endif
   endfunc
   
   float func ResultIndex(complex pz)
     GradientColoring.ResultIndex(pz)
 
     ; OVERVIEW
     ; apply trap merge update function
     ; color based on coloring mode
 
     m_TrapMode.Result()
     m_Solid = @p_usesolid && m_TrapMode.IsSolid()  ; honor solid flag
     return m_TrapColoring.Result(m_TrapMode)
   endfunc
 
 protected:
   Generator m_TrapSelect
   UserTransform m_TrapTransform
   TrapShape m_TrapShape
   Transfer m_TrapTransfer
   TrapMode m_TrapMode
   TrapShape m_TrapTexture
   TrapColoring m_TrapColoring
 
   float m_TrapSelectSequence
 
 default:
   title = "Orbit Traps Gradient (UF5)"
 
   int param v_dmj_orbittrapscoloring
     caption = "Version (DMJ_OrbitTrapsColoring)"
     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_dmj_orbittrapscoloring < 100
   endparam
 
   Generator param f_trapselect
     caption = "Trap Iteration"
     default = DMJ_TrapSelect
     expanded = false
   endparam
   float param p_trapselectthreshold
     caption = "Threshold"
     default = 0.5
     hint = "When using a Generator other than a TrapSelect type, values could range anywhere from 0 to 1. This threshold sets which values will be interpreted as 'do not trap' and which will be interpreted as 'trap'."
     visible = (@f_trapselect != DMJ_TrapSelect)
   endparam
   UserTransform param f_traptransform
     caption = "Trap Position"
     default = TrapTransform
     hint = "This transform is commonly used to set the position of the trap. You can load any Transform object here, but if you replace the TrapTransform you will lose the ability to position the trap. To regain that ability, use the TransformMerge class here so you can load any Transform and still be able to use a TrapTransform object."
   endparam
   TrapShape param f_trapshape
     caption = "Trap Shape"
     default = DMJ_TrapShapeAstroid
     hint = "The trap shape sets the overall shape of the trap. Its only task is to measure the distance from any point to the trap shape."
   endparam
   Transfer param f_traptransfer
     caption = "Trap Transfer"
     default = TrapTransfer
     hint = "A transfer allows you to manipulate the distances provided by the trap shape."
     expanded = false
   endparam
   TrapMode param f_trapmode
     caption = "Trap Mode"
     default = DMJ_TrapModeClosest
   endparam
   float param p_threshold
     caption = "Trap Threshold"
     default = 0.25
     hint = "This is the overall size or thickness of the trap area. (Some trap modes may not use the threshold value.)"
     visible = (@f_trapmode == TrapModeWithThreshold)
   endparam
   bool param p_usesolid
     caption = "Use Solid Color"
     default = false
     hint = "If checked, any areas not inside any trap shape will be colored the solid color."
   endparam
   TrapShape param f_traptexture
     caption = "Trap Texture"
     default = DMJ_TrapShapeFlat
     hint = "A trap shape that is used as a texture. Textures do not change the shape of the trap but may change its coloring."
   endparam
   bool param p_textureposttransform
     caption = "Use Transformed Coordinate"
     default = false
     hint = "If checked, texturing will be based on the final transformed coordinate used in the trap shape (i.e. it will follow the trap shape, rather than being separate from it)."
     visible = (@f_traptexture != DMJ_TrapShapeFlat)
   endparam
   float param p_texturestrength
     caption = "Texture Amount"
     default = 0.25
     hint = "Sets the overall amount of texture to be used. Larger numbers will increase the effect of the texture. A value of 0 will remove the effects of the texture."
     visible = (@f_traptexture != DMJ_TrapShapeFlat)
   endparam
   TrapColoring param f_trapcoloring
     caption = "Trap Color Mode"
     default = TrapColoringDistance
   endparam
 }
 


Constructor Summary
DMJ_OrbitTrapsColoring()
           
DMJ_OrbitTrapsColoring(Generic pparent)
           
 
Method Summary
 void Init(complex pz, complex ppixel)
          Set up for a sequence of values
 void Iterate(complex pz)
          Process the next value in the sequence
 float ResultIndex(complex pz)
          Produce a resulting color index after a sequence is finished
 
Methods inherited from class common:GradientColoring
IsGradient, IsSolid, Result
 
Methods inherited from class common:Coloring
GetPixel
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

DMJ_OrbitTrapsColoring

public DMJ_OrbitTrapsColoring(Generic pparent)

DMJ_OrbitTrapsColoring

public DMJ_OrbitTrapsColoring()
Method Detail

Init

public void Init(complex pz,
                 complex ppixel)
Description copied from class: GradientColoring
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).

Overrides:
Init in class GradientColoring
Parameters:
pz - first value for the sequence; for a normal coloring formula, this will be #z
ppixel - seed value for the sequence; for a normal coloring formula, this will be #pixel

Iterate

public void Iterate(complex pz)
Description copied from class: GradientColoring
Process the next value in the sequence

As long as the sequence has not bailed out, this function will be continually called to produce sequence values. Note that such processing generally will not know in advance precisely how long the sequence is, and should be prepared to deal with sequences of arbitrary length.

Your coloring may determine at some point that a solid color should be used rather than an index value.

Overrides:
Iterate in class GradientColoring
Parameters:
pz - next value in the sequence; corresponds to #z in a coloring formula

ResultIndex

public float ResultIndex(complex pz)
Description copied from class: GradientColoring
Produce a resulting color index after a sequence is finished

This corresponds to the final: section in a coloring formula. Once it is called, no further calls to Iterate() should be made without calling Init() first.

Overrides:
ResultIndex in class GradientColoring
Returns:
the gradient index (corresponding to #index in a coloring formula)