From 6bcf419d2e8f739b432d4790d1ba9d48ab65365b Mon Sep 17 00:00:00 2001 From: fcolin Date: Fri, 18 Nov 2011 12:14:12 +0000 Subject: --- ARMFCaptureD3D/MinMaxAvg.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 ARMFCaptureD3D/MinMaxAvg.cpp (limited to 'ARMFCaptureD3D/MinMaxAvg.cpp') diff --git a/ARMFCaptureD3D/MinMaxAvg.cpp b/ARMFCaptureD3D/MinMaxAvg.cpp new file mode 100644 index 0000000..2cd21b0 --- /dev/null +++ b/ARMFCaptureD3D/MinMaxAvg.cpp @@ -0,0 +1,31 @@ +#include +#include "MinMaxAvg.h" + + +MinMaxAvg::MinMaxAvg(void) +{ + Raz(); +} + + +MinMaxAvg::~MinMaxAvg(void) +{ +} +void MinMaxAvg::Raz() +{ + min = FLT_MAX; + max = FLT_MIN; + sum = 0; + count = 0; +} +void MinMaxAvg::SetValue( float value ) +{ + if ( value > max ) max = value; + else if ( value < min ) min = value; + sum += value; + count++; +} +float MinMaxAvg::Avg() +{ + return sum / count; +} \ No newline at end of file -- cgit v1.1