Page 1 of 1

how does clamp work?

Posted: Fri Jul 08, 2011 10:22 am
by Paradan
do you put it in before you assign a value or after?

Posted: Fri Jul 08, 2011 10:31 am
by Kjell
Hi Paradan,

It doesn't matter all that much .. but using the function directly when assigning a value is a fraction faster.

Code: Select all

// Indirect
T = App.Time;
T = clamp(T,0,1);

// Direct
T = clamp(App.Time,0,1);
Personally I usually go with what benefits the readability / easy-of-use of my code when the performance difference is marginal.

K