Ignore:
Timestamp:
04/20/20 23:27:35 (4 months ago)
Author:
Maciej Komosinski
Message:

Added a few utility/helper functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/common/nonstd_math.h

    r899 r913  
    5858#endif
    5959
    60 
    6160//handling floating point exceptions
    6261void fpExceptInit(); //call once, before ...Enable/Disable
     
    6766template <typename Value, typename Linear> Value universal_lerp(Value a,Value b,Linear t) {return a*(1-t)+b*t;}
    6867
     68template <typename T> T linearTransform(T value, T min_in, T max_in, T min_out, T max_out)
     69{
     70        return min_out + (value-min_in)*(max_out-min_out)/(max_in-min_in);
     71}
     72
    6973#endif
Note: See TracChangeset for help on using the changeset viewer.