common
Class TrapTransfer

Object
  extended by common:Generic
      extended by common:Transfer
          extended by common:TrapTransfer

class 
Transfer:TrapTransfer

This is a basic transfer function useful for trap distances.


Ultra Fractal Source

Toggle UF Source Code Display

 class TrapTransfer(Transfer) {
   ; This is a basic transfer function useful for trap distances.
   
 public:
   func TrapTransfer(Generic pparent)
     Transfer.Transfer(pparent)
   endfunc
 
   float func Iterate(float pr)
     float rt = (pr + @p_preadd1) * @p_prescale + @p_preadd2
 
     if (@p_function == 1)    ; log
       rt = log(rt)
     elseif (@p_function == 2)  ; sqrt
       rt = sqrt(rt)
     elseif (@p_function == 3)  ; cuberoot
       rt = (rt)^(1/3)
     elseif (@p_function == 4)  ; exp
       rt = exp(rt)
     elseif (@p_function == 5)  ; sqr
       rt = sqr(rt)
     elseif (@p_function == 6)  ; cube
       rt = (rt)^3
     elseif (@p_function == 7)  ; sin
       rt = sin(rt)
     elseif (@p_function == 8)  ; cos
       rt = cos(rt)
     elseif (@p_function == 9)  ; tan
       rt = tan(rt)
     elseif (@p_function == 10)  ; sinc (modified form)
       if (rt == 0)
         rt = 1
       else
         rt = sin(#pi*rt)/rt
       endif
     elseif (@p_function == 11)  ; round
       rt = round(rt)
     endif
 
     rt = (rt + @p_postadd1) * @p_postscale + @p_postadd2
     if (@p_abs)
       rt = abs(rt)
     endif
     
     return rt
   endfunc
   
 default:
   title = "Trap Transfer"
 
   int param v_traptransfer
     caption = "Version (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_traptransfer < 100
   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" "log" "sqrt" "cuberoot" "exp" "sqr" "cube" "sin" "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."
   endparam
 }
 


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

TrapTransfer

public TrapTransfer(Generic pparent)

TrapTransfer

public 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