mmf
Class MMF_TrapModeSmoothTurningPoints

Object
  extended by common:Generic
      extended by common:TrapMode
          extended by common:TrapModeWithThreshold
              extended by mmf:MMF_TrapModeSmoothWithThreshold
                  extended by mmf:MMF_TrapModeSmoothTurningPoints

class 
MMF_TrapModeSmoothWithThreshold:MMF_TrapModeSmoothTurningPoints

Traps the values occurring when the distance found hits maxima and/or minima.

Note that in this class the Results are taken care of in the child TrapMode "m_trapmode".


Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_TrapModeSmoothTurningPoints(MMF_TrapModeSmoothWithThreshold) {
 ; Traps the values occurring when the distance found hits maxima
 ; and/or minima.<p>
 ; Note that in this class the Results are taken care of in the child
 ; TrapMode "m_trapmode".
 public:
   import "common.ulb"
 
   func MMF_TrapModeSmoothTurningPoints(Generic pparent)
     MMF_TrapModeSmoothWithThreshold.MMF_TrapModeSmoothWithThreshold(pparent)
     m_trapmode = new @p_trapmode(this)
   endfunc
 
   func Init(complex pz)
     m_Iterations = 0
     m_trapmode.Init(pz)
     m_dir = 0
     m_olddist = 0.0
     m_oldv = 0.0
     m_pzold = (0,0)
     m_pztold = (0,0)
     m_pdold = 0.0
     m_ptold = 0.0
   endfunc
 
   func Iterate(complex pz, complex pzt, float pdistance, float ptexture)
     float v = pdistance
     int dir = 0
     if @p_mode=="Differences"
       v = pdistance - m_olddist
     endif
     if v - m_oldv < 0.0
       dir = -1 ; decreasing
     elseif v - m_oldv > 0.0
       dir = 1 ; increasing
     endif
     if (@p_trap=="All" && dir!=m_dir) || (@p_trap=="Maxima" && dir<m_dir) \
        || (@p_trap=="Minima" && dir>m_dir)
       if @p_version=="Original" || m_Iterations==0
         m_trapmode.Iterate(pz, pzt, pdistance, ptexture)
       else
         m_trapmode.Iterate(m_pzold, m_pztold, m_pdold, m_ptold)
       endif
     else
       m_trapmode.IterateSilent()
     endif
     m_Iterations = m_Iterations + 1
     m_dir = dir
     m_olddist = pdistance
     m_oldv = v
     m_pzold = pz
     m_pztold = pzt
     m_pdold = pdistance
     m_ptold = ptexture
   endfunc
 
   func IterateSilent()
     m_Iterations = m_Iterations + 1
     m_trapmode.IterateSilent()
   endfunc
 
   func Result()
     m_trapmode.Result()
   endfunc
   
   func OldResult()
     if @p_trapmode==MMF_TrapModeSmooth
       MMF_TrapModeSmooth(m_trapmode).OldResult()
     elseif @p_trapmode==MMF_TrapModeSmoothWithThreshold
       MMF_TrapModeSmoothWithThreshold(m_trapmode).OldResult()
     endif
   endfunc
   
   ; call this to determine if the last sequence produced a solid point<br>
   bool func IsSolid()
     return m_trapmode.IsSolid()
   endfunc
   
   ; get a final untransformed point<br>
   complex func GetUntransformedPoint(int pindex)
     return m_trapmode.GetUntransformedPoint(pindex)
   endfunc
 
   ; get a final transformed point<br>
   complex func GetTransformedPoint(int pindex)
     return m_trapmode.GetTransformedPoint(pindex)
   endfunc
 
   ; get a final distance<br>
   float func GetDistance(int pindex)
     return m_trapmode.GetDistance(pindex)
   endfunc
 
   ; get a final texture<br>
   float func GetTexture(int pindex)
     return m_trapmode.GetTexture(pindex)
   endfunc
 
   ; get a final iteration<br>
   float func GetIteration(int pindex)
     return m_trapmode.GetIteration(pindex)
   endfunc
 
   ; get threshold value<br>
   float func GetThreshold()
     return m_trapmode.GetThreshold()
   endfunc
   
   ; set threshold value<br>
   func SetThreshold(float pthreshold)
     m_trapmode.SetThreshold(pthreshold)
   endfunc
   
   ; get whether threshold is even used<br>
   bool func UsesThreshold()
     return m_trapmode.UsesThreshold()
   endfunc
 
 private:
   TrapMode m_trapmode
   complex m_pzold
   complex m_pztold
   float m_pdold
   float m_ptold
   float m_olddist
   float m_oldv
   int m_dir
 
 default:
   title = "Smooth Turning Points"
   rating = recommended
   int param p_version
     caption = "Version"
     enum = "Original" "Fixed"
     default = 0
     hint = "In the original version the values to be trapped are those \
             from the iteration after the maxima or minima actually \
             occurred. In the fixed version the algorithm is corrected \
             so the values from when the maxima or minima occurred are \
             trapped. Note that when iteration skipping is used the \
             'Fixed' option will only work properly if it is plugged \
             into compatible formulas such as mmf.ulb Smooth Orbit Traps."
   endparam
   int param p_trap
     caption = "Turning Points to Trap"
     enum = "All" "Maxima" "Minima"
     default = 0
     hint = "You can choose to trap all turning points, or just minima, or \
             just maxima."
   endparam
   int param p_mode
     caption = "Values to use"
     enum = "Distances" "Differences"
     default = 0
     hint = "When using distances the turning points in the distances \
             are trapped. When using differences the turning points in \
             the changes to the distances are trapped."
   endparam
   TrapMode param p_trapmode
     caption = "Trap Mode for the Turning Points"
     default = MMF_TrapModeSmoothAverage
     hint = "If using mmf.ulb Smooth Orbit Traps then it's best to choose \
             a 'Smooth' trap mode for example from mmf.ulb, obviously don't \
             choose 'Smooth Turning Points' here."
   endparam
 }
 


Constructor Summary
MMF_TrapModeSmoothTurningPoints()
           
MMF_TrapModeSmoothTurningPoints(Generic pparent)
           
 
Method Summary
 float GetDistance(int pindex)
          get a final distance
 float GetIteration(int pindex)
          get a final iteration
 float GetTexture(int pindex)
          get a final texture
 float GetThreshold()
          get threshold value
 complex GetTransformedPoint(int pindex)
          get a final transformed point
 complex GetUntransformedPoint(int pindex)
          get a final untransformed point
 void Init(complex pz)
          call this at the beginning of each sequence
 boolean IsSolid()
          call this to determine if the last sequence produced a solid point
 void Iterate(complex pz, complex pzt, float pdistance, float ptexture)
          call this for each point
 void IterateSilent()
          call this for each point that is ignored (for smooth orbit traps)
if the last point was trapped then copy the current values into the "old" ones
 void OldResult()
          call this to compute penultimate results
 void Result()
          call this to compute final results
 void SetThreshold(float pthreshold)
          set threshold value
 boolean UsesThreshold()
          get whether threshold is even used
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_TrapModeSmoothTurningPoints

public MMF_TrapModeSmoothTurningPoints(Generic pparent)

MMF_TrapModeSmoothTurningPoints

public MMF_TrapModeSmoothTurningPoints()
Method Detail

Init

public void Init(complex pz)
Description copied from class: MMF_TrapModeSmoothWithThreshold
call this at the beginning of each sequence

Overrides:
Init in class MMF_TrapModeSmoothWithThreshold
Parameters:
pz - the initial z value

Iterate

public void Iterate(complex pz,
                    complex pzt,
                    float pdistance,
                    float ptexture)
Description copied from class: MMF_TrapModeSmoothWithThreshold
call this for each point

Note that derived functions should always copy all used parameters to the "old" versions when they are changed as here.

m_wastrapped should be set to true in the derived function when the main (current) values get changed

Overrides:
Iterate in class MMF_TrapModeSmoothWithThreshold
Parameters:
pz - the z value
pzt - the transformed z value
pdistance - the trap distance
ptexture - tyhe texture value

IterateSilent

public void IterateSilent()
Description copied from class: MMF_TrapModeSmoothWithThreshold
call this for each point that is ignored (for smooth orbit traps)
if the last point was trapped then copy the current values into the "old" ones

Overrides:
IterateSilent in class MMF_TrapModeSmoothWithThreshold

Result

public void Result()
Description copied from class: TrapMode
call this to compute final results

Overrides:
Result in class TrapMode

OldResult

public void OldResult()
Description copied from class: MMF_TrapModeSmoothWithThreshold
call this to compute penultimate results

This should only be called after previously calling Result() and getting the actual result value using the Trap Color Mode since the original result values are destroyed by this call.

Overrides:
OldResult in class MMF_TrapModeSmoothWithThreshold

IsSolid

public boolean IsSolid()
call this to determine if the last sequence produced a solid point

Overrides:
IsSolid in class TrapMode

GetUntransformedPoint

public complex GetUntransformedPoint(int pindex)
get a final untransformed point

Overrides:
GetUntransformedPoint in class TrapMode

GetTransformedPoint

public complex GetTransformedPoint(int pindex)
get a final transformed point

Overrides:
GetTransformedPoint in class TrapMode

GetDistance

public float GetDistance(int pindex)
get a final distance

Overrides:
GetDistance in class TrapMode

GetTexture

public float GetTexture(int pindex)
get a final texture

Overrides:
GetTexture in class TrapMode

GetIteration

public float GetIteration(int pindex)
get a final iteration

Overrides:
GetIteration in class TrapMode

GetThreshold

public float GetThreshold()
get threshold value

Overrides:
GetThreshold in class TrapModeWithThreshold

SetThreshold

public void SetThreshold(float pthreshold)
set threshold value

Overrides:
SetThreshold in class TrapModeWithThreshold

UsesThreshold

public boolean UsesThreshold()
get whether threshold is even used

Overrides:
UsesThreshold in class TrapModeWithThreshold