Standard
Class Standard_OrbitTraps

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:GradientColoring
              extended by Standard:Standard_OrbitTraps

class 
GradientColoring:Standard_OrbitTraps

Object version of Orbit Traps in Standard.ucl. This generalizes the orbit trap concept using various classes in common.ulb, so everyone can write new trap shapes, trap colorings, etc. Originally written by Damien M. Jones


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_OrbitTraps(common.ulb:GradientColoring) {
 ;
 ; Object version of Orbit Traps in Standard.ucl. This generalizes the orbit
 ; trap concept using various classes in common.ulb, so everyone can write new
 ; trap shapes, trap colorings, etc.
 ;
 ; Originally written by Damien M. Jones
 ;
 public:
   func Standard_OrbitTraps(Generic pparent)
     GradientColoring(pparent)
     fTransform = new @transform(this)
     fShape = new @shape(this)
     fTransfer = new @transfer(this)
     fMode = new @mode(this)
     fColoring = new @coloring(this)
     fShape.SetThreshold(@threshold)
     fMode.SetThreshold(@threshold)
   endfunc
 
   func Init(complex pz, complex ppixel)
     GradientColoring.Init(pz, ppixel)
     fTransform.init(pz)
     fShape.init(pz)
     fTransfer.init(pz)
     fMode.init(pz)
   endfunc
 
   func Iterate(complex pz)
     ; Don't call inherited Iterate() for efficiency.
     complex zt = fTransform.Iterate(pz)
     float distance = fShape.Iterate(zt)
     distance = fTransfer.Iterate(distance)
     if !fTransform.IsSolid()
       fMode.Iterate(pz, zt, distance, 0.0)  ; No texture support here
     else
       fMode.IterateSilent()
     endif
   endfunc
 
   float func ResultIndex(complex pz)
     fMode.Result()
     if @usesolid
       m_Solid = fMode.IsSolid()
     endif
     return fColoring.Result(fMode)
   endfunc
   
 private:
   TrapColoring fColoring
   TrapMode fMode
   TrapShape fShape
   Transfer fTransfer
   UserTransform fTransform
 
 default:
   title = "Orbit Traps"
   helpfile = "Uf*.chm"
   helptopic = "Html/coloring/standard/orbittraps.html"
   rating = recommended
   UserTransform param transform
     caption = "Trap Position"
     default = TrapTransform
     expanded = false
     hint = "Transforms the orbit values from the fractal formula before they \
             are passed to the trap shape."
   endparam
   TrapShape param shape
     caption = "Trap Shape"
     default = Standard_TrapShapePoint
     hint = "Selects the shape of the orbit trap."
   endparam
   Transfer param transfer
     caption = "Trap Transfer"
     default = TrapTransfer
     expanded = false
     hint = "Provides additional options to scale and transform the distance \
             that the trap shape returns."
   endparam
   TrapMode param mode
     caption = "Trap Mode"
     default = Standard_TrapModeClosest
     hint = "Selects how points will be chosen to use for coloring."
   endparam
   float param threshold
     caption = "Trap Threshold"
     default = 0.25
     hint = "This is the overall size or thickness of the trap area."
     visible = (@mode == TrapModeWithThreshold)
   endparam
   bool param usesolid
     caption = "Use Solid Color"
     default = false
     hint = "If checked, any areas not inside any trap shape will be colored the solid color."
   endparam
   TrapColoring param coloring
     caption = "Trap Coloring"
     default = Standard_TrapColoringDistance
     hint = "Selects what information from the chosen points (see Trap Mode) \
             is used to produce a color."
   endparam
 }
 


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

Standard_OrbitTraps

public Standard_OrbitTraps(Generic pparent)

Standard_OrbitTraps

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