|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:TrapMode
common:TrapModeWithThreshold
mmf:MMF_TrapModeSmoothWithThreshold
mmf:MMF_TrapModeSmoothTurningPoints
class
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".
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 |
|---|
public MMF_TrapModeSmoothTurningPoints(Generic pparent)
public MMF_TrapModeSmoothTurningPoints()
| Method Detail |
|---|
public void Init(complex pz)
MMF_TrapModeSmoothWithThreshold
Init in class MMF_TrapModeSmoothWithThresholdpz - the initial z value
public void Iterate(complex pz,
complex pzt,
float pdistance,
float ptexture)
MMF_TrapModeSmoothWithThresholdNote 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
Iterate in class MMF_TrapModeSmoothWithThresholdpz - the z valuepzt - the transformed z valuepdistance - the trap distanceptexture - tyhe texture valuepublic void IterateSilent()
MMF_TrapModeSmoothWithThreshold
IterateSilent in class MMF_TrapModeSmoothWithThresholdpublic void Result()
TrapMode
Result in class TrapModepublic void OldResult()
MMF_TrapModeSmoothWithThreshold
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.
OldResult in class MMF_TrapModeSmoothWithThresholdpublic boolean IsSolid()
IsSolid in class TrapModepublic complex GetUntransformedPoint(int pindex)
GetUntransformedPoint in class TrapModepublic complex GetTransformedPoint(int pindex)
GetTransformedPoint in class TrapModepublic float GetDistance(int pindex)
GetDistance in class TrapModepublic float GetTexture(int pindex)
GetTexture in class TrapModepublic float GetIteration(int pindex)
GetIteration in class TrapModepublic float GetThreshold()
GetThreshold in class TrapModeWithThresholdpublic void SetThreshold(float pthreshold)
SetThreshold in class TrapModeWithThresholdpublic boolean UsesThreshold()
UsesThreshold in class TrapModeWithThreshold
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||