|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:TrapShape
kcc5:KCC_RingSegmentsTrap
class
The Ring Segments trap.
For an example of what this trap looks like,
click here.
class KCC_RingSegmentsTrap( common.ulb:TrapShape ) {
; The Ring Segments trap.
; <p>
; For an example of what this trap looks like,
; <a href="../additional/kcc5/images/Ring Segments Trap.jpg">click here</a>.
;
public:
import "common.ulb"
; constructor
func KCC_RingSegmentsTrap( Generic pparent )
TrapShape.TrapShape( pparent )
endfunc
; call this before each sequence of values to be trapped
func Init( complex pz )
TrapShape.Init( pz )
Phi = #pi * 0.125
Ro = @ringRadius + @ringThickness
Py = @ringRadius * sin( Phi )
Px = @ringRadius * cos( Phi )
Dsqd = @ringRadius * @ringRadius + Ro * Ro - 2 * Ro * Px
endfunc
; call this for each iteration being trapped
float func Iterate( complex pz )
TrapShape.Iterate( pz )
float d = abs( cabs( pz ) - @ringRadius )
if( d < @ringThickness )
float x = real( pz )
float y = imag( pz )
float Xabs = abs( x )
float Yabs = abs( y )
float WtoPsqd = 0
if (Xabs >= Yabs)
WtoPsqd = (Xabs-Px) * (Xabs-Px) + (Yabs-Py) * (Yabs-Py)
else
WtoPsqd = (Xabs-Py) * (Xabs-Py) + (Yabs-Px) * (Yabs-Px)
endif
if( x >= 0 && y >= 0 )
if( Xabs >= Yabs )
m_LastChannel = 0
else
m_LastChannel = 1
endif
elseif (x < 0 && y >= 0)
if (Xabs < Yabs)
m_LastChannel = 2
else
m_LastChannel = 3
endif
elseif (x < 0 && y < 0)
if (Xabs >= Yabs)
m_LastChannel = 4
else
m_LastChannel = 5
endif
else
if (Xabs < Yabs)
m_LastChannel = 6
else
m_LastChannel = 7
endif
endif
m_Texture = sqrt( WtoPsqd / Dsqd )
return d
else
return 1e20 ; return a very large distance
endif
endfunc
float func GetTextureValue()
return m_Texture
endfunc
protected:
float Phi
float Ro
float Px
float Py
float Dsqd
float m_Texture
default:
title = "Ring Segments Trap"
int param v_KCC_RingSegmentsTrap
caption = "Version (KCC_RingSegmentsTrap)"
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_KCC_RingSegmentsTrap < 100
endparam
float param @ringRadius
caption = "Ring Radius"
default = 1.0
hint = "The radius to the midline of the ring."
endparam
float param @ringThickness
caption = "Ring Thickness"
default = 0.1
hint = "The thickness of the ring."
endparam
}
| Constructor Summary | |
|---|---|
KCC_RingSegmentsTrap()
|
|
KCC_RingSegmentsTrap(Generic pparent)
constructor |
|
| Method Summary | |
|---|---|
float |
GetTextureValue()
Get texture value. |
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 |
| Methods inherited from class common:TrapShape |
|---|
GetColorChannel, GetTransformedPoint, IterateSilent, SetThreshold |
| Methods inherited from class common:Generic |
|---|
GetParent |
| Methods inherited from class Object |
|---|
|
| Constructor Detail |
|---|
public KCC_RingSegmentsTrap(Generic pparent)
public KCC_RingSegmentsTrap()
| Method Detail |
|---|
public void Init(complex pz)
Init in class TrapShapepublic float Iterate(complex pz)
Iterate in class TrapShapepublic float GetTextureValue()
TrapShapeOrdinarily, 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.
GetTextureValue in class TrapShape
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||