llsmoothstep.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLSMOOTHSTEP_H
00033 #define LL_LLSMOOTHSTEP_H
00034 
00035 template <class LLDATATYPE>
00036 inline LLDATATYPE llsmoothstep(const LLDATATYPE& edge0, const LLDATATYPE& edge1, const LLDATATYPE& value)
00037 {
00038     if (value < edge0)
00039                 return (LLDATATYPE)0;
00040 
00041         if (value >= edge1)
00042                 return (LLDATATYPE)1;
00043 
00044         // Scale/bias into [0..1] range
00045         LLDATATYPE scaled_value = (value - edge0) / (edge1 - edge0);
00046 
00047         return scaled_value * scaled_value * (3 - 2 * scaled_value);
00048 }
00049 
00050 #endif // LL_LLSMOOTHSTEP_H

Generated on Fri May 16 08:32:08 2008 for SecondLife by  doxygen 1.5.5