mmf
Class MMF_TrapModeSmooth

Object
  extended by common:Generic
      extended by common:TrapMode
          extended by mmf:MMF_TrapModeSmooth
Direct Known Subclasses:
MMF_TrapModeSmoothChangeAverage

class 
TrapMode:MMF_TrapModeSmooth

This is a generic trap mode class for use with MMF_SmoothOrbitTraps.

It takes a sequence of complex point pairs (untransformed and transformed) and distances and produces a final result, storing old values for smoothing.


Ultra Fractal Source

Toggle UF Source Code Display

 class MMF_TrapModeSmooth(common.ulb:TrapMode) {
 ;
 ; This is a generic trap mode class for use with MMF_SmoothOrbitTraps.<br>
 ; <p>It takes a sequence of complex point pairs (untransformed
 ; and transformed) and distances and produces a final result,
 ; storing old values for smoothing.<br>
 ;  
 public:
   ; @param pparent the parent, generally "this" for the parent, or zero
   func MMF_TrapModeSmooth(Generic pparent)
     TrapMode.TrapMode(pparent)
   endfunc
   
   ; call this at the beginning of each sequence
   ; @param pz the initial z value
   func Init(complex pz)
     m_Iterations = 0
     m_Solid = false
     int j = 3
      repeat
       m_UntransformedPoints[j] = m_OldUntransformedPoints[j] = (0,0)
       m_TransformedPoints[j] = m_OldTransformedPoints[j] = (0,0)
        m_IterationPoints[j] = m_OldIterationPoints[j] = 0
        m_Distances[j] = m_OldDistances[j] = 0.0
       m_Textures[j] = m_OldTextures[j] = 0.0
      until  (j=j-1)<0
      m_wastrapped = false
   endfunc
   
   ; call this for each point
   ; <p>Note that derived functions should always copy all used
   ; parameters to the "old" versions when they are changed as here.<p>
   ;  m_wastrapped should be set to true in the derived
   ; function when the main (current) values get changed<br>
   ; @param pz the z value
   ; @param pzt the transformed z value
   ; @param pdistance the trap distance
   ; @param ptexture tyhe texture value
   func Iterate(complex pz, complex pzt, float pdistance, float ptexture)
     if m_wastrapped
       m_OldDistances[0] = m_Distances[0]
       m_OldTextures[0] = m_Textures[0]
       m_OldUntransformedPoints[0] = m_UntransformedPoints[0]
       m_OldTransformedPoints[0] = m_TransformedPoints[0]
       m_OldIterationPoints[0] = m_IterationPoints[0]
     endif
     m_Iterations = m_Iterations + 1
   endfunc
   
   ; call this for each point that is ignored (for smooth orbit traps)<br>
   ; if the last point was trapped then copy the current values into
   ; the "old" ones
   func IterateSilent()
     if m_wastrapped
       m_OldDistances[0] = m_Distances[0]
       m_OldTextures[0] = m_Textures[0]
       m_OldUntransformedPoints[0] = m_UntransformedPoints[0]
       m_OldTransformedPoints[0] = m_TransformedPoints[0]
       m_OldIterationPoints[0] = m_IterationPoints[0]
       m_wastrapped = false
     endif
     m_Iterations = m_Iterations + 1
   endfunc
 
   ; call this to compute final results
 ;  func Result()
 ;  endfunc
   
   ; call this to compute penultimate results
   ; <p>Should be called only after the usual result has been returned
   ; by the appropriate Get function.<br>
   func OldResult()
     ; Note that in some cases if less than two values were trapped this<br>
     ; should be skipped i.e. old result should be the same as result<br>
     m_Distances[0] = m_OldDistances[0]
     m_Textures[0] = m_OldTextures[0]
     m_UntransformedPoints[0] = m_OldUntransformedPoints[0]
      m_TransformedPoints[0] = m_OldTransformedPoints[0]
     m_IterationPoints[0] = m_OldIterationPoints[0]
     m_Iterations = m_Iterations - 1
   endfunc  
 
 protected:
   complex m_OldUntransformedPoints[4]
   complex m_OldTransformedPoints[4]
   float m_OldIterationPoints[4]
   float m_OldDistances[4]
   float m_OldTextures[4]
   bool m_wastrapped
 
 default:
   int param v_mmf_trapmodesmooth
     caption = "Version (MMF_TrapModeSmooth)"
     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_mmf_trapmodesmooth < 100
   endparam
 }
 


Constructor Summary
MMF_TrapModeSmooth()
           
MMF_TrapModeSmooth(Generic pparent)
           
 
Method Summary
 void Init(complex pz)
          call this at the beginning of each sequence
 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 final results endfunc call this to compute penultimate results
 
Methods inherited from class common:TrapMode
GetDistance, GetIteration, GetTexture, GetThreshold, GetTransformedPoint, GetUntransformedPoint, IsSolid, Result, SetThreshold, UsesThreshold
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MMF_TrapModeSmooth

public MMF_TrapModeSmooth(Generic pparent)
Parameters:
pparent - the parent, generally "this" for the parent, or zero

MMF_TrapModeSmooth

public MMF_TrapModeSmooth()
Method Detail

Init

public void Init(complex pz)
call this at the beginning of each sequence

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

Iterate

public void Iterate(complex pz,
                    complex pzt,
                    float pdistance,
                    float ptexture)
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 TrapMode
Parameters:
pz - the z value
pzt - the transformed z value
pdistance - the trap distance
ptexture - tyhe texture value

IterateSilent

public 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

Overrides:
IterateSilent in class TrapMode

OldResult

public void OldResult()
call this to compute final results endfunc call this to compute penultimate results

Should be called only after the usual result has been returned by the appropriate Get function.