reb
Class REB_DistanceEstimateGradient
Object
common:Generic
common:Coloring
common:GradientColoring
reb:REB_DistanceEstimateGradient
class
- GradientColoring:REB_DistanceEstimateGradient
A smoothing algorithm that works for both convergent and divergent fractals.
Ultra Fractal Source
Toggle UF Source Code Display
class REB_DistanceEstimateGradient(common.ulb:GradientColoring) {
; A smoothing algorithm that works for both convergent and divergent fractals. <br>
public:
import "common.ulb"
import "dmj5.ulb"
; constructor
func REB_DistanceEstimateGradient(Generic pparent)
GradientColoring.GradientColoring(pparent)
m_Texture = new @ftexture(this)
endfunc
; initialize the objects
func Init(complex pz, complex ppixel)
GradientColoring.Init(pz, ppixel)
m_Texture.Init(pz)
m_iterexp = 0
m_zold = pz
dist = 0
pot = 0
grad = 0
inc = 0
endfunc
; call for each iterated point
func Iterate(complex pz)
GradientColoring.Iterate(pz)
m_iterexp = m_iterexp + exp(-cabs(pz)-0.5/(cabs(m_zold - pz)))
inc = exp(-cabs(pz)-0.5/(cabs(m_zold - pz)))
if (@mtile == "Fixed Iteration" && m_iterations == @iternum) || \
(@mtile == "Cabs(z)" && cabs(pz) < @tcabs)|| @mtile == "none"
ptexture = m_Texture.Iterate(pz)
endif
m_zold = pz
endfunc
; override the parent and call in the final section of the coloring formula. <br>
float func ResultIndex(complex pz)
pot = exp(-m_iterexp*log(2))
grad = exp(-inc*log(2))*@gradcorr
dist = sinh(pot)/(2*exp(pot)*grad)
float returnval = 0
if @showborder
if dist < @border
returnval = ptexture*@txamt
else
m_solid = true
endif
else
returnval = dist + ptexture*@txamt
endif
return returnval
endfunc
protected:
float ptexture
TrapShape m_Texture
float m_iterexp
complex m_zold
float dist
float inc
float pot
float grad
default:
title = "Distance Estimate Gradient"
int param v_distanceestimategrad
caption = "Version (Distance Estimate Gradient)"
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_distanceestimategrad < 100
endparam
heading
text = "This is a gradient coloring formula with textures which works \
for both convergent and divergent \
fractals. It is highly recommended that the divergent bailout be \
set to at least 1e8 and the convergent bailout be set to no more than \
1e-8. If this is not done then the smoothing may be unsatisfactory. \
It works with fractals that have both divergent and convergent regions, \
such as the Magnet fractals."
endheading
float param gradcorr
caption = "Gradient Correction"
default = 1.0
endparam
bool param showborder
caption = "Show border only"
default = false
endparam
float param border
caption = "borderwidth"
default = 0.01
visible = @showborder
endparam
float param txamt
caption = "Texture amount"
default = 0.0
visible = @fTexture != DMJ_TrapShapeFlat
endparam
heading
text = "Fixed Iteration will give a smoother tiling, while 'Cabs(z)' \
will more consistently follow the fractal shape."
visible = @fTexture != DMJ_TrapShapeFlat
endheading
param mtile
caption = "Tile method"
default = 1
enum = "None" "Fixed Iteration" "Cabs(z)"
visible = @fTexture != DMJ_TrapShapeFlat
endparam
int param iternum
caption = "Iter number"
default = 1
hint = "Changes the texture mapping."
visible = @fTexture != DMJ_TrapShapeFlat && \
@mtile == "Fixed iteration"
endparam
float param tcabs
caption = "Cabs limit"
default = 1.0
visible = @mtile == "Cabs(z)"
hint = "Changes the texture/image mapping."
visible = @fTexture != DMJ_TrapShapeFlat
endparam
TrapShape param fTexture
caption = "Texture"
default = DMJ_TrapShapeFlat
hint = "Use TrapShape plugins as textures."
endparam
}
Methods inherited from class Object |
|
REB_DistanceEstimateGradient
public REB_DistanceEstimateGradient(Generic pparent)
- constructor
REB_DistanceEstimateGradient
public REB_DistanceEstimateGradient()
Init
public void Init(complex pz,
complex ppixel)
- initialize the objects
- Overrides:
Init
in class GradientColoring
- Parameters:
pz
- first value for the sequence; for a normal coloring formula, this will be #zppixel
- seed value for the sequence; for a normal coloring formula, this will be #pixel
Iterate
public void Iterate(complex pz)
- call for each iterated point
- Overrides:
Iterate
in class GradientColoring
- Parameters:
pz
- next value in the sequence; corresponds to #z in a coloring formula
ResultIndex
public float ResultIndex(complex pz)
- override the parent and call in the final section of the coloring formula.
- Overrides:
ResultIndex
in class GradientColoring
- Returns:
- the gradient index (corresponding to #index in a coloring formula)