kcc5
Class KCC_FlexballsTrap
Object
common:Generic
common:TrapShape
kcc5:KCC_FlexballsTrap
class
- TrapShape:KCC_FlexballsTrap
For an example of what this trap looks like,
click here.
Ultra Fractal Source
Toggle UF Source Code Display
class KCC_FlexballsTrap( common.ulb:TrapShape ) {
; <p>
; For an example of what this trap looks like,
; <a href="../additional/kcc5/images/Flexballs Trap.jpg">click here</a>.
;
public:
import "common.ulb"
; constructor
func KCC_FlexballsTrap( Generic pparent )
TrapShape.TrapShape( pparent )
endfunc
; call this before each sequence of values to be trapped
func Init( complex pz )
TrapShape.Init( pz )
Rm = @flexballRadius
Ro = Rm + @flexballSize
pY = 0.382683432365 * @flexballSize
pX = 0.923879532511 * @flexballSize
Dsqd0 = Ro * Ro + @flexballSize * @flexballSize - (Ro + Ro) * Px
endfunc
; call this for each iteration being trapped
float func Iterate( complex pz )
TrapShape.Iterate( pz )
float d = abs( ( cabs( pz ) - @flexballRadius ) )
if( d < @flexballSize )
x = real( pz )
y = imag( pz )
xAbs = abs( x )
yAbs = abs( y )
if xAbs >= yAbs
ZtoPsqd = (xAbs - Px)^2 + (yAbs - pY)^2
adjust = 1
else
ZtoPsqd = (xAbs - Py)^2 + (yAbs - pX)^2
adjust = 0
endif
if( x >= 0 && y >= 0 )
m_LastChannel = 1 - adjust
elseif( x < 0 && y >= 0 )
m_LastChannel = 2 + adjust
elseif( x < 0 && y < 0 )
m_LastChannel = 5 - adjust
else
m_LastChannel = 6 + adjust
endif
m_Texture = sqrt( ZtoPsqd / Dsqd0 )
return d
else
return 1e20
endif
endfunc
float func GetTextureValue()
return m_Texture
endfunc
protected:
int adjust
float x
float y
float xAbs
float yAbs
float pX
float pY
float Rm
float Ro
float ratio
float Dsqd0
float ZtoPsqd
float m_Texture
default:
title = "Flexballs Trap"
int param v_KCC_FlexballsTrap
caption = "Version (KCC_FlexballsTrap)"
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_FlexballsTrap < 100
endparam
float param flexballSize
caption = "Flexball Size"
default = 0.1
hint = "The size of the balls. Suggested range (0.01 to 2.0)."
endparam
float param flexballRadius
caption = "Flexball Radius"
default = 0.15
hint = "The radius of the balls. Suggested range (0.01 to 2.0)."
endparam
}
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 Object |
|
KCC_FlexballsTrap
public KCC_FlexballsTrap(Generic pparent)
- constructor
KCC_FlexballsTrap
public KCC_FlexballsTrap()
Init
public void Init(complex pz)
- call this before each sequence of values to be trapped
- Overrides:
Init
in class TrapShape
Iterate
public float Iterate(complex pz)
- call this for each iteration being trapped
- Overrides:
Iterate
in class TrapShape
GetTextureValue
public float GetTextureValue()
- Description copied from class:
TrapShape
- Get texture value.
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.
- Overrides:
GetTextureValue
in class TrapShape
- Returns:
- the texture value for the last point used (i.e. call GetTextureValue() after calling Iterate(), not before)