Functional.hh
Go to the documentation of this file.
00001 
00039 #ifndef CRL_MULTISENSE_FUNCTIONAL_HH
00040 #define CRL_MULTISENSE_FUNCTIONAL_HH
00041 
00042 namespace crl {
00043 namespace multisense {
00044 namespace details {
00045 namespace utility {
00046 
00047 template <class Type>
00048 inline bool
00049 approximatelyEqual(Type const& xx, Type const& yy, Type const& epsilon) {
00050     return (((xx)-(yy) < (epsilon)) && ((xx)-(yy) > -(epsilon)));
00051 }
00052 
00053 template <class Type>
00054 inline bool
00055 approxEqual(Type const& xx, Type const& yy, Type const& epsilon) {
00056     return approximatelyEqual(xx, yy, epsilon);
00057 }
00058 
00059 template <class Type>
00060 inline Type
00061 boundValue(Type const& value, Type const& minimum, Type const& maximum) {
00062     return ((value > maximum) ? maximum : (value < minimum) ? minimum : value);
00063 }
00064 
00065 template <class Type>
00066 inline Type
00067 decayedAverage(Type const& previous, Type const& samples, Type const& newest) {
00068     return (((samples - 1) * previous) + newest) / samples;
00069 }
00070 
00071 }}}} // namespaces
00072 
00073 #endif /* #ifndef CRL_MULTISENSE_FUNCTIONAL_HH */


multisense_lib
Author(s):
autogenerated on Mon Oct 9 2017 03:06:21