WebCore::GestureSpeedCalc Class Reference

Class for calculating value deltas. More...

#include <GestureSpeedCalc.h>

List of all members.

Public Member Functions

 GestureSpeedCalc ()
void firstSample (double timestamp, double sample)
 Insert first sample.
void insertSample (double timestamp, double sample)
 Insert subsequent samples.
double speed () const
 Query the current speed of data value change.

Private Attributes

double m_prevTimeStamp
double m_prevSample
double m_speed
double m_prevRawSpeed

Detailed Description

Class for calculating value deltas.

GestureSpeedCalc objects are used by gesture recognizers to determine value deltas, aka. speed values. Values are fed into GestureSpeedCalc as timestamp,value pairs and a simple floating point value for the speed can be queried.

Definition at line 24 of file GestureSpeedCalc.h.


Constructor & Destructor Documentation

WebCore::GestureSpeedCalc::GestureSpeedCalc (  ) 

Definition at line 26 of file GestureSpeedCalc.cpp.


Member Function Documentation

void WebCore::GestureSpeedCalc::firstSample ( double  timestamp,
double  sample 
)

Insert first sample.

Insert the first data sample. Initializes the previous state if any, and sets speed to 0.

Parameters:
timestamp Timestamp of data.
sample Data value at the given timestamp.
See also:
insertSample
speed

Definition at line 43 of file GestureSpeedCalc.cpp.

References m_prevRawSpeed, m_prevSample, m_prevTimeStamp, and m_speed.

void WebCore::GestureSpeedCalc::insertSample ( double  timestamp,
double  sample 
)

Insert subsequent samples.

Insert sample and possibly update speed depending on timestamp difference to previous sample(s).

Parameters:
timestamp Timestamp of data.
sample Data value at the given timestamp.
See also:
speed

Definition at line 59 of file GestureSpeedCalc.cpp.

References m_prevRawSpeed, m_prevSample, m_prevTimeStamp, m_speed, WebCore::speedAveragingTime, and WebCore::updateSpeedTimeThreshold.

WebCore::GestureSpeedCalc::speed (  )  const [inline]

Query the current speed of data value change.

Queries the current speed at which the data is changing. The speed is determined by the difference between the last two accepted data samples, divided by time difference. Only samples with an undefined time interval between them are considered for speed calculations.

Returns:
current speed of change.

Definition at line 30 of file GestureSpeedCalc.h.

References m_speed.


Member Data Documentation

Definition at line 36 of file GestureSpeedCalc.h.

Definition at line 34 of file GestureSpeedCalc.h.

Definition at line 33 of file GestureSpeedCalc.h.

Definition at line 35 of file GestureSpeedCalc.h.


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208