mmf Class MMF_TrapTransfer

Object common:Generic common:Transfer mmf:MMF_TrapTransfer

class
Transfer:MMF_TrapTransfer

This transfer method is based on the original UF gradient transfer but with added options.
David Makin, May 2008

Ultra Fractal Source
class MMF_TrapTransfer(common.ulb:Transfer) {
;
; This transfer method is based on the original UF gradient transfer
; David Makin, May 2008<br>

public:
; @param pparent the parent, generally "this" for the parent, or zero
func MMF_TrapTransfer(Generic pparent)
Transfer.Transfer(pparent)
endfunc

; @param pr the float value to manipulate
; @return the manipulated value
float func Iterate(float pr)
float x = @p_offset1 + (pr + @p_offset0) * @p_zscale0
if @p_forcepos && x<0.0
x = abs(x)
endif
if x<0.0
x = 0.0
else
if (@p_xfer == "Sqr")
x = 2.0*sqr(x)
elseif (@p_xfer == "Sqrt")
x = 0.5*sqrt(x)
elseif (@p_xfer == "Cube")
x = 3.0*x^3.0
elseif (@p_xfer == "CubeRoot")
x = (x^(1.0/3.0))/3.0
elseif (@p_xfer == "Log")
x = log(1.0 + x)
elseif (@p_xfer == "Exp")
if (x >= 100.0)
x = exp(100.0)
else
x = exp(x)
endif
elseif (@p_xfer == "Sin")
x = abs(sin(x))
elseif (@p_xfer == "ArcTan")
x = abs(atan(x))
elseif (@p_xfer == "Cos")
x = 1.0 + cos(x)
elseif (@p_xfer == "LogTan")
x = log(1.0 + abs(tan(x)))
elseif (@p_xfer == "LogLog")
x = log(1.0 + log(1.0 + x))
elseif (@p_xfer == "InvArcTan")
x = 0.0005*((2.0*#pi/atan(x))^@p_iatpower - 1.0)
elseif (@p_xfer == "Power")
x = x^@p_power
endif
endif
return @p_offset3 + (x + @p_offset2) * @p_zscale1
endfunc

default:

int param v_mmf_traptransfer
caption = "Version (MMF_TrapTransfer)"
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_mmf_traptransfer < 100
endparam

float param p_offset0
caption = "Initial Pre-Offset"
default = 0.0
hint = "Applied prior to the pre-scale."
endparam
float param p_zscale0
caption = "Pre-Scale"
default = 1.0
exponential = true
hint = "Applied prior to the 'Transfer Function'."
endparam
float param p_offset1
caption = "Final Pre-Offset"
default = 0.0
hint = "Applied after the pre-scale but before the 'Transfer \
Function'."
endparam
bool param p_forcepos
caption = "Force positive"
default = false
hint = "When enabled the value passed to the transfer function is made \
positive using abs(). If disabled then negative values are made \
zero and the transfer function is skipped."
endparam
int param p_xfer
caption = "Transfer Function"
default = 0
enum = "Linear" "Sqr" "Sqrt" "Cube" "CubeRoot" "Log" "Exp" "Sin" \
"ArcTan" "Cos" "LogTan" "LogLog" "InvArcTan" "Power"
hint = "This function will be applied to the value. 'InvArcTan' is \
specifically designed to produce evenly spread smooth \
iteration colouring - use the power adjust to compensate \
for different bailout values."
endparam
float param p_iatpower
caption = "Power adjust (for InvArcTan)"
default = 2.0
hint = "For when adjusting smooth iteration colouring, this power \
adjust allows you to compensate for different bailout values, \
the larger the bailout, the larger you'll need to make the \
power value e.g. around 2 for a bailout of 128 or around 3.5 \
for a bailout of 65536."
visible = @p_xfer==12
endparam
float param p_power
caption = "Power"
default = 4.0
visible = @p_xfer==13
endparam
float param p_offset2
caption = "Initial Post-Offset"
default = 0.0
hint = "Applied prior to the post-scale."
endparam
float param p_zscale1
caption = "Post-Scale"
default = 1.0
exponential = true
hint = "Applied after the 'Transfer Function'."
endparam
float param p_offset3
caption = "Final Post-Offset"
default = 0.0
hint = "The final offset."
endparam
}

Constructor Summary
MMF_TrapTransfer()

MMF_TrapTransfer(Generic pparent)

Method Summary
float Iterate(float pr)
call this to process another value in the sequence

Methods inherited from class common:Transfer
Init, IterateSilent

Methods inherited from class common:Generic
GetParent

Methods inherited from class Object

Constructor Detail

MMF_TrapTransfer

public MMF_TrapTransfer(Generic pparent)
Parameters:
pparent - the parent, generally "this" for the parent, or zero

MMF_TrapTransfer

public MMF_TrapTransfer()
Method Detail

Iterate

public float Iterate(float pr)
Description copied from class: Transfer
call this to process another value in the sequence

Overrides:
Iterate in class Transfer
Parameters:
pr - the float value to manipulate
Returns:
the manipulated value