|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:TrapShape
kcc5:KCC_CurlsTrap
class
The Curls trap.
For an example of what this trap looks like,
click here.
class KCC_CurlsTrap( common.ulb:TrapShape ) {
; The Curls trap.
; <p>
; For an example of what this trap looks like,
; <a href="../additional/kcc5/images/Curls 2 Trap.jpg">click here</a>.
;
public:
import "common.ulb"
; constructor
func KCC_CurlsTrap( Generic pparent )
TrapShape.TrapShape( pparent )
endfunc
; call this before each sequence of values to be trapped
func Init( complex pz )
TrapShape.Init( pz )
cx = 8.0 * #pi * @spiralSize
endfunc
; call this for each iteration being trapped
float func Iterate( complex pz )
TrapShape.Iterate( pz )
trapped = false
if( real( pz ) >= 0.0 )
deltax = real( pz ) - cx
v = deltax + flip( imag( pz ) )
theta = atan2( v )
if( @beadFactor > 0 )
size = @spiralWidth * abs( sin( theta * @beadFactor ) )
else
size = @spiralWidth
endif
int i = 0
float thetap = theta
v = exp( flip( theta ) )
while (i <= @numLoops && !trapped)
sr = @spiralSize * thetap
m = cx + sr * v
distance = sqrt( |pz - m| )
trapped = ( distance < size )
thetap = thetap + 2 * #pi
i = i + 1
endwhile
if( trapped )
m_LastChannel = m_Iterations
m_Texture = distance / size
return distance
endif
endif
return 1e20
endfunc
float func GetTextureValue()
return m_Texture
endfunc
protected:
bool trapped
float d
float cx
float deltax
float distance
float size
float theta
float sr
complex m
complex v
float m_Texture
default:
title = "Curls Trap"
int param v_KCC_CurlsTrap
caption = "Version (KCC_CurlsTrap)"
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_CurlsTrap < 100
endparam
float param spiralSize
caption = "Spiral Size"
default = 0.3
hint = "The size of the spiral."
endparam
float param spiralWidth
caption = "Spiral Width"
default = 0.3
hint = "The width of the spiral."
endparam
int param beadFactor
caption = "Bead Factor"
default = -1
hint = "Determines if the spiral should be beaded. Suggested range \
(5 to 30)."
endparam
int param numLoops
caption = "Times to increment curls trap loop."
default = 3
min = 0
endparam
}
| Constructor Summary | |
|---|---|
KCC_CurlsTrap()
|
|
KCC_CurlsTrap(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_CurlsTrap(Generic pparent)
public KCC_CurlsTrap()
| 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 | ||||||||