From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03642.html | 356 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 356 insertions(+) create mode 100644 docs/doxygen/nel/a03642.html (limited to 'docs/doxygen/nel/a03642.html') diff --git a/docs/doxygen/nel/a03642.html b/docs/doxygen/nel/a03642.html new file mode 100644 index 00000000..41ee329e --- /dev/null +++ b/docs/doxygen/nel/a03642.html @@ -0,0 +1,356 @@ + + +NeL: NLMISC::CValueSmoother class Reference + + + +
+

NLMISC::CValueSmoother Class Reference

#include <value_smoother.h> +

+

Inheritance diagram for NLMISC::CValueSmoother: +

+ +NLMISC::CValueSmootherTemplate< float > + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void addValue (floatdt)
 add a new value to be smoothed.

 CValueSmoother (uint n=16)
 Constructor.

const std::vector< float > & getLastFrames () const
uint getNumFrame () const
float getSmoothValue () const
 get the smoothed value.

void init (uint n)
 reset the ValueSmoother, and set the number of frame to smooth.

void reset ()
 reset only the ValueSmoother

+

Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + + +
NLMISC::CValueSmoother::CValueSmoother uint  n = 16  )  [inline, explicit]
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 201 of file value_smoother.h. +

+References uint. +

+

00201                                            : CValueSmootherTemplate<float>(n)
+00202         {
+00203         }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CValueSmootherTemplate< float >::addValue float   dt  )  [inline, inherited]
+
+ + + + + +
+   + + +

+add a new value to be smoothed. +

+ +

+Definition at line 80 of file value_smoother.h. +

+References min, and uint. +

+Referenced by NL3D::CCloudScape::anim(), NL3D::CLoadBalancingGroup::computeRatioAndSmooth(), and NL3D::CCloudScape::init(). +

+

00081         {
+00082                 if (_LastFrames.empty())
+00083                         return;
+00084 
+00085                 // update the frame sum. NB: see init(), at start, array is full of 0. so it works even for un-inited values.
+00086                 _FrameSum-= _LastFrames[_CurFrame];
+00087                 _FrameSum+= dt;
+00088                 
+00089                 // backup this value in the array.
+00090                 _LastFrames[_CurFrame]= dt;
+00091                 
+00092                 // next frame.
+00093                 _CurFrame++;
+00094 //              _CurFrame%=_LastFrames.size();
+00095                 if (_CurFrame >= _LastFrames.size())
+00096                         _CurFrame -= _LastFrames.size();
+00097                 
+00098                 // update the number of frames added.
+00099                 _NumFrame++;
+00100                 _NumFrame= std::min(_NumFrame, (uint)_LastFrames.size());
+00101         }
+
+

+ + + + +
+ + + + + + + + + +
const std::vector<float >& NLMISC::CValueSmootherTemplate< float >::getLastFrames  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 117 of file value_smoother.h. +

+

00118         {
+00119                 return _LastFrames;
+00120         }
+
+

+ + + + +
+ + + + + + + + + +
uint NLMISC::CValueSmootherTemplate< float >::getNumFrame  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 112 of file value_smoother.h. +

+References uint. +

+

00113         {
+00114                 return _NumFrame;
+00115         }
+
+

+ + + + +
+ + + + + + + + + +
float NLMISC::CValueSmootherTemplate< float >::getSmoothValue  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+get the smoothed value. +

+ +

+Definition at line 104 of file value_smoother.h. +

+Referenced by NL3D::CLoadBalancingGroup::computeRatioAndSmooth(). +

+

00105         {
+00106                 if(_NumFrame>0)
+00107                         return T(_FrameSum / _NumFrame);
+00108                 else
+00109                         return T(0);
+00110         }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CValueSmootherTemplate< float >::init uint  n  )  [inline, inherited]
+
+ + + + + +
+   + + +

+reset the ValueSmoother, and set the number of frame to smooth. +

+ +

+Definition at line 56 of file value_smoother.h. +

+References uint. +

+Referenced by NL3D::CLoadBalancingGroup::CLoadBalancingGroup(), NL3D::CLoadBalancingGroup::computeRatioAndSmooth(), and NL3D::CCloudScape::init(). +

+

00057         {
+00058                 // reset all the array to 0.
+00059                 _LastFrames.clear();
+00060 
+00061                 if (n > 0)
+00062                         _LastFrames.resize(n, 0);
+00063                 
+00064                 _CurFrame = 0;
+00065                 _NumFrame = 0;
+00066                 _FrameSum = 0;
+00067         }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CValueSmootherTemplate< float >::reset void   )  [inline, inherited]
+
+ + + + + +
+   + + +

+reset only the ValueSmoother +

+ +

+Definition at line 70 of file value_smoother.h. +

+Referenced by NL3D::CLoadBalancingGroup::computeRatioAndSmooth(). +

+

00071         {
+00072                 std::fill(_LastFrames.begin(), _LastFrames.end(), T(0));
+00073                 
+00074                 _CurFrame = 0;
+00075                 _NumFrame = 0;
+00076                 _FrameSum = 0;
+00077         }
+
+


The documentation for this class was generated from the following file: +
Generated on Tue Mar 16 13:40:03 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1