|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object common:Generic common:TrapShape
class
Trap Shape base class.
This is a generic trap shape class. The purpose of a trap shape
is very simple: to take one or more complex values and determine
a "distance" to a trap shape for those values. There are some
extra features provided to facilitate many of the things that
have been done in the past with trap shapes and trapping
algorithms.
class TrapShape(Generic) { ; Trap Shape base class. ; <p> ; This is a generic trap shape class. The purpose of a trap shape ; is very simple: to take one or more complex values and determine ; a "distance" to a trap shape for those values. There are some ; extra features provided to facilitate many of the things that ; have been done in the past with trap shapes and trapping ; algorithms. public: ; constructor func TrapShape(Generic pparent) Generic.Generic(pparent) endfunc ; call this before each sequence of values to be trapped func Init(complex pz) m_Iterations = 0 m_LastZ = pz m_LastChannel = 0 endfunc ; call this for each iteration being trapped float func Iterate(complex pz) m_Iterations = m_Iterations + 1 m_LastZ = pz return real(pz) endfunc ; Update internal counters without transforming a value ; func IterateSilent() ; Perform the same iteration-count update as Iterate(), but ; don't return a value. See the comments in Iterate() for ; more information on when to call this. m_Iterations = m_Iterations + 1 endfunc ; call this to set the threshold selected by the user ; it's up to the calling code to apply the threshold, ; but some trap shapes or merges need to know the ; threshold to work properly func SetThreshold(float pthreshold) m_Threshold = pthreshold endfunc ; Get transformed point. ; <p> ; Some trap modes and trap coloring modes require ; access to the "transformed" point. This is the ; final point that is actually used by the trap shape ; class to test against the trap. For most trap shape ; classes this will be exactly the same as the pz ; passed into Iterate(), and those classes can use ; this base class functionality. However, some trap ; shape classes (e.g. TrapShapeMerge, TrapShapeBlock) ; perform some internal transformations on pz before ; passing it to the trap shape; this gives them the ; opportunity to call their trap shape's function to ; get the final transformed point. ; ; @return the last transformed point used (i.e. call GetTransformedPoint() after calling Iterate(), not before) complex func GetTransformedPoint() return m_LastZ endfunc ; Get texture value. ; <p> ; Ordinarily, a trap shape does not have a native texture ; (it is flat). Some formulas may pair trap shapes with ; trap textures, and may need more information about trap ; textures when trap shapes are nested via TrapShapeMerge. ; This function provides support for accessing texture ; information. ; ; @return the texture value for the last point used (i.e. call GetTextureValue() after calling Iterate(), not before) float func GetTextureValue() return 0 endfunc ; Get color channel. ; <p> ; Some trap shapes may be inherently multi-colored. Such ; trap shapes may either override this function to return ; a different color index, or may simply store the index ; in m_LastChannel and this function will return it. The ; color index is just an indication of which color channel ; (in a GradientWrapper object) should be used. ; ; @return the color channel value for the last point used (i.e. call GetColorChannel() after calling Iterate(), not before) int func GetColorChannel() return m_LastChannel endfunc protected: int m_Iterations float m_Threshold complex m_LastZ int m_LastChannel default: int param v_trapshape caption = "Version (TrapShape)" default = 101 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_trapshape < 100 endparam }
Constructor Summary | |
---|---|
TrapShape()
|
|
TrapShape(Generic pparent)
constructor |
Method Summary | |
---|---|
int |
GetColorChannel()
Get color channel. |
float |
GetTextureValue()
Get texture value. |
complex |
GetTransformedPoint()
Get transformed point. |
void |
Init(complex pz)
call this before each sequence of values to be trapped |
float |
Iterate(complex pz)
call this for each iteration being trapped |
void |
IterateSilent()
Update internal counters without transforming a value |
void |
SetThreshold(float pthreshold)
call this to set the threshold selected by the user it's up to the calling code to apply the threshold, but some trap shapes or merges need to know the threshold to work properly |
Methods inherited from class common:Generic |
---|
GetParent |
Methods inherited from class Object |
---|
|
Constructor Detail |
---|
public TrapShape(Generic pparent)
public TrapShape()
Method Detail |
---|
public void Init(complex pz)
public float Iterate(complex pz)
public void IterateSilent()
public void SetThreshold(float pthreshold)
public complex GetTransformedPoint()
Some trap modes and trap coloring modes require access to the "transformed" point. This is the final point that is actually used by the trap shape class to test against the trap. For most trap shape classes this will be exactly the same as the pz passed into Iterate(), and those classes can use this base class functionality. However, some trap shape classes (e.g. TrapShapeMerge, TrapShapeBlock) perform some internal transformations on pz before passing it to the trap shape; this gives them the opportunity to call their trap shape's function to get the final transformed point.
public float GetTextureValue()
Ordinarily, a trap shape does not have a native texture (it is flat). Some formulas may pair trap shapes with trap textures, and may need more information about trap textures when trap shapes are nested via TrapShapeMerge. This function provides support for accessing texture information.
public int GetColorChannel()
Some trap shapes may be inherently multi-colored. Such trap shapes may either override this function to return a different color index, or may simply store the index in m_LastChannel and this function will return it. The color index is just an indication of which color channel (in a GradientWrapper object) should be used.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |