dmj5
Class DMJ_TrapShapeFBM
Object
common:Generic
common:TrapShape
dmj5:DMJ_TrapShapeFBM
class
- TrapShape:DMJ_TrapShapeFBM
Fractional Brownian Motion (fBm) trap shape class.
Ultra Fractal Source
Toggle UF Source Code Display
class DMJ_TrapShapeFBM(common.ulb:TrapShape) {
; Fractional Brownian Motion (fBm) trap shape class.
public:
import "common.ulb"
func DMJ_TrapShapeFBM(Generic pparent)
TrapShape.TrapShape(pparent)
m_Noise = new @f_noise(this)
m_Rotation = (0,1) ^ (@p_angle / 90.0)
m_RotationStep = (0,1) ^ (@p_anglestep / 90.0)
endfunc
func Init(complex pz)
TrapShape.Init(pz)
m_Noise.Init(pz)
endfunc
float func Iterate(complex pz)
TrapShape.Iterate(pz)
float sum = 0.0
float amplitude = 1.0
float basis = 0.0
pz = pz * @p_scale * m_Rotation + @p_offset
int j = 0
while (j < @p_octaves)
basis = m_Noise.Iterate(pz) * amplitude
sum = sum + basis
amplitude = amplitude * @p_step
pz = pz * m_RotationStep / @p_step
j = j + 1
endwhile
if (@p_octaves - floor(@p_octaves) > 0)
sum = sum - basis
basis = basis * (@p_octaves - floor(@p_octaves))^(@p_step)
sum = sum + basis
endif
return sum
endfunc
protected:
TrapShape m_Noise
complex m_Rotation
complex m_RotationStep
default:
title = "fBm"
int param v_dmj_trapshapefbm
caption = "Version (DMJ_TrapShapeFBM)"
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_dmj_trapshapefbm < 100
endparam
TrapShapeNoise param f_noise
caption = "Noise Basis Function"
default = TrapShapeNoise
hint = "Sets the noise function that is used as the foundation for the fractional noise computation."
expanded = false
endparam
float param p_scale
caption = "Scale"
default = 1.0
hint = "This is the overall scale of the noise. Larger numbers will produce finer-grained noise."
endparam
float param p_angle
caption = "Rotation"
default = 0.0
hint = "This is the angle, in degrees, of the noise."
endparam
float param p_step
caption = "Scale Step"
default = 0.5
min = 0.0
hint = "This is the step in scale between noise iterations. Reducing this value will result in noise with less 'bumpiness'."
endparam
float param p_anglestep
caption = "Rotation Step"
default = 37.0
hint = "This is the angle, in degrees, to rotate between noise iterations. You should use values that do not divide evenly into 360 for best results."
endparam
float param p_octaves
caption = "Octaves"
default = 7
min = 1
hint = "This is the number of iterations of the noise formula. More iterations will add progressively finer variations to the noise. If you use a non-integer value, the final iteration's contribution will only be partially used."
endparam
complex param p_offset
caption = "Offset"
default = (0,0)
hint = "This is the offset of the entire pattern. This offset is applied only once, after scale and rotation."
endparam
}
Method Summary |
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 |
|
DMJ_TrapShapeFBM
public DMJ_TrapShapeFBM(Generic pparent)
DMJ_TrapShapeFBM
public DMJ_TrapShapeFBM()
Init
public void Init(complex pz)
- Description copied from class:
TrapShape
- call this before each sequence of values to be trapped
- Overrides:
Init
in class TrapShape
Iterate
public float Iterate(complex pz)
- Description copied from class:
TrapShape
- call this for each iteration being trapped
- Overrides:
Iterate
in class TrapShape