reb
Class TrapTransferBias

Object
  extended by common:Generic
      extended by common:Transfer
          extended by reb:TrapTransferBias

class 
Transfer:TrapTransferBias

This is a basic transfer function useful for trap distances.


Ultra Fractal Source

Toggle UF Source Code Display

 class TrapTransferBias(common.ulb:Transfer) {
   ; This is a basic transfer function useful for trap distances.
   
 public:
   import "common.ulb"
   func TrapTransferBias(Generic pparent)
     Transfer.Transfer(pparent)
   endfunc
 
   float func Iterate(float pr)
     float rt = (pr + @p_preadd1) * @p_prescale + @p_preadd2
     if @p_cut
       rt = rt - @bias
     endif
 
     if (@p_function == "sqr")
       rt = sqr(rt)
     elseif (@p_function == "sqrt")
       rt = sqrt(rt)
     elseif (@p_function == "cube")
       rt = (rt)^3
     elseif (@p_function == "cuberoot")
       rt = rt^(1/3)
     elseif (@p_function == "log")
       rt = log(rt)
     elseif (@p_function == "exp")
       rt = exp(rt)
     elseif (@p_function == "sin")
       rt = sin(rt)
     elseif (@p_function == "atan")
       rt = atan(rt)
     elseif (@p_function == "cos")
       rt = cos(rt)
     elseif (@p_function == "tan")
       rt = tan(rt)
     elseif (@p_function == "sinc")
       if (rt == 0)
         rt = 1
       else
         rt = sin(#pi*rt)/rt
       endif
     elseif (@p_function == "round")
       rt = round(rt)
     endif
 
     rt = (rt + @p_postadd1) * @p_postscale + @p_postadd2
     if (@p_abs)
       rt = abs(rt)
     endif
     if @p_cut
       if rt < 0
         rt = 0
       endif
     endif
     
     return rt
   endfunc
   
 default:
   title = "Trap Transfer Bias"
 
   int param v_traptransferbias
     caption = "Version (TrapTransferBias)"
     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_traptransferbias < 100
   endparam
   float param bias
     caption = "Distance bias"
     default = 0.5
     visible = @p_cut
   endparam
   float param p_preadd1
     caption = "Pre-offset"
     default = 0.0
     hint = "This value is added to the trap distance before the multiplier is used."
   endparam
   float param p_prescale
     caption = "Pre-scale"
     default = 1.0
     hint = "This value is multiplied with the trap distance before the function is applied to it."
   endparam
   float param p_preadd2
     caption = "Offset"
     default = 0.0
     hint = "This value is added to the trap distance after the multiplier is used but before the function is applied."
   endparam
   int param p_function
     caption = "Function"
     default = 0
     enum = "linear" "sqr" "sqrt" "cube" "cuberoot" "log" "exp" "sin" "atan" \
            "cos" "tan" "sinc" "round"
     hint = "This function modifies the trap distance."
   endparam
   float param p_postadd1
     caption = "Post-offset"
     default = 0.0
     hint = "This value is added to the trap distance after the function is applied."
   endparam
   float param p_postscale
     caption = "Post-scale"
     default = 1.0
     hint = "This value is multiplied with the function and offset result."
   endparam
   float param p_postadd2
     caption = "Final offset"
     default = 0.0
     hint = "This value is added to the trap distance after the post-scale multiplier is used."
   endparam
   bool param p_abs
     caption = "No Negative Values"
     default = false
     hint = "If enabled, eliminates 'negative' distances by taking the absolute value."
     visible = !@p_cut
   endparam
   bool param p_cut
     caption = "Cut at zero"
     default = false
     visible = !@p_abs
   endparam
 }
 


Constructor Summary
TrapTransferBias()
           
TrapTransferBias(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

TrapTransferBias

public TrapTransferBias(Generic pparent)

TrapTransferBias

public TrapTransferBias()
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