Standard
Class Standard_DirectOrbitTraps

Object
  extended by common:Generic
      extended by common:Coloring
          extended by common:DirectColoring
              extended by Standard:Standard_DirectOrbitTraps

class 
DirectColoring:Standard_DirectOrbitTraps

Object version of Direct 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. See also the Orbit Traps class. Originally written by Damien M. Jones


Ultra Fractal Source

Toggle UF Source Code Display

 class Standard_DirectOrbitTraps(common.ulb:DirectColoring) {
 ;
 ; Object version of Direct 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. See also the Orbit Traps class.
 ;
 ; Originally written by Damien M. Jones
 ;
 public:
   func Standard_DirectOrbitTraps(Generic pparent)
     DirectColoring(pparent)
     fMerge = new @colorMergeClass(this)
     fTransform = new @transform(this)
     fTrap = new @trap(this)
     fTransfer = new @transfer(this)
   endfunc
 
   func Init(complex pz, complex ppixel)
     DirectColoring.Init(pz, ppixel)
     fTransform.Init(pz)
     fTrap.Init(pz)
     fTransfer.Init(pz)
     fColor = @startcolor
   endfunc
 
   func Iterate(complex pz)
     ; Don't call inherited Iterate() for efficiency.
     complex zt = fTransform.Iterate(pz)
     color current = fTrap.Iterate(zt)
     current = fTransfer.Iterate(current)
     if !fTransform.IsSolid()
       if @trapmergeorder == "Bottom-up"
         fColor = fMerge.FullMerge(fColor, current, @trapmergeopacity)
       else
         fColor = fMerge.FullMerge(current, fColor, @trapmergeopacity)
       endif
     endif
   endfunc
 
   color func Result(complex pz)
     return fColor
   endfunc
 
 private:
   color fColor
   ColorMerge fMerge
   ColorTransfer fTransfer
   UserTransform fTransform
   ColorTrap fTrap
 
 default:
   title = "Direct Orbit Traps"
   helpfile = "Uf*.chm"
   helptopic = "Html/coloring/standard/directorbittraps.html"
   rating = recommended
   color param startcolor
     caption = "Base Color"
     default = rgb(0,0,0)
     hint = "Specifies the 'base', or starting color with which all iterations' \
             colors will be merged."
   endparam
   ColorMerge param colorMergeClass
     caption = "Trap Color Merge"
     default = DefaultColorMerge
     hint = "Selects a class responsible for blending colors at each iteration."
   endparam
   param trapmergeopacity
     caption = "Trap Merge Opacity"
     default = 0.2
     hint = "Sets the opacity of each trap shape. Even if you set this value to 1 \
           (forcing all traps to be fully opaque) you can still control opacity \
           using the alpha channel in the gradient."
   endparam
   param trapmergeorder
     caption = "Trap Merge Order"
     default = 0
     enum = "Bottom-up" "Top-down"
     hint = "Sets the order in which traps will be merged. Bottom-up merges new \
       traps on top of previous ones. Top-down merges new traps underneath \
       previous ones."
   endparam
   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 color trap."
   endparam
   ColorTrap param trap
     caption = "Color Trap"
     default = Standard_ColorTrapWrapper
     hint = "The color trap examines orbit values from the fractal formula and \
             converts them to a color. These colors are merged according to the \
             merging parameters above."
   endparam
   ColorTransfer param transfer
     caption = "Color Transfer"
     default = NullColorTransfer
     expanded = false
     hint = "Provides additional options to disturb the colors returned by the \
             color trap."
   endparam
 }
 


Constructor Summary
Standard_DirectOrbitTraps()
           
Standard_DirectOrbitTraps(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
 color Result(complex pz)
          Produce a resulting color index after a sequence is finished
 
Methods inherited from class common:DirectColoring
IsSolid
 
Methods inherited from class common:Coloring
GetPixel, IsGradient
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

Standard_DirectOrbitTraps

public Standard_DirectOrbitTraps(Generic pparent)

Standard_DirectOrbitTraps

public Standard_DirectOrbitTraps()
Method Detail

Init

public void Init(complex pz,
                 complex ppixel)
Description copied from class: DirectColoring
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 DirectColoring
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: DirectColoring
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 DirectColoring
Parameters:
pz - next value in the sequence; corresponds to #z in a coloring formula

Result

public color Result(complex pz)
Description copied from class: DirectColoring
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:
Result in class DirectColoring
Returns:
the gradient index (corresponding to #index in a coloring formula)