MCPcopy Create free account
hub / github.com/Snapchat/Valdi / addSample

Method addSample

snap_drawing/src/snap_drawing/cpp/Utils/VelocityTracker.cpp:21–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19VelocityTracker::Moment::Moment(const TimePoint& time, Scalar sample) : time(time), sample(sample) {}
20
21void VelocityTracker::addSample(const TimePoint& time, Scalar sample) {
22 // First element in the list is the most recent event
23 _moments.emplace_front(time, sample);
24 while (_moments.size() > kMomentHistory) {
25 _moments.pop_back();
26 }
27}
28
29Scalar VelocityTracker::computeVelocity() const {
30 return computeImpulseVelocity();

Callers 1

didContinueMoveMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected