MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ update()

template<typename T >
void MayaFlux::Kinesis::MotionChannel< T >::update ( const T &  raw_sample,
double  dt 
)
inline

Feed one raw sample, denoise it, and push the cleaned value.

Parameters
raw_sampleRaw value for this step
dtElapsed time since the previous sample; stored for use by derivative<N>() and curvature() so the caller does not have to pass it again at every read

Definition at line 143 of file MotionChannel.hpp.

144 {
145 m_last_dt = dt;
146 ++m_generation;
147 const auto raw_components = read_components(raw_sample);
148 std::array<double, component_count> clean_components {};
149 for (size_t i = 0; i < component_count; ++i) {
150 m_estimates[i].update(raw_components[i]);
151 clean_components[i] = m_estimates[i].value();
152 }
153 const T clean = assemble_from_components<T>(clean_components);
154 m_history.push(clean);
155
156 if constexpr (std::is_same_v<T, glm::vec2>) {
157 if (m_trajectory_2d)
158 m_trajectory_2d->update(clean);
159 }
160 if constexpr (std::is_same_v<T, glm::vec3>) {
161 if (m_trajectory_3d)
162 m_trajectory_3d->update(clean);
163 }
164 }
Memory::HistoryBuffer< T > m_history
std::vector< Stochastic::Estimate > m_estimates
std::unique_ptr< SymbolicTrajectory< Lattice3D, glm::uvec3 > > m_trajectory_3d
std::unique_ptr< SymbolicTrajectory< Lattice2D, glm::uvec2 > > m_trajectory_2d
static constexpr size_t component_count
std::array< double, estimate_component_count_v< T > > read_components(const T &value) noexcept
Read T's components into an array of doubles.

References MayaFlux::Kinesis::MotionChannel< T >::component_count, MayaFlux::Kinesis::MotionChannel< T >::m_estimates, MayaFlux::Kinesis::MotionChannel< T >::m_generation, MayaFlux::Kinesis::MotionChannel< T >::m_history, MayaFlux::Kinesis::MotionChannel< T >::m_last_dt, MayaFlux::Kinesis::MotionChannel< T >::m_trajectory_2d, MayaFlux::Kinesis::MotionChannel< T >::m_trajectory_3d, and MayaFlux::Kinesis::read_components().

+ Here is the call graph for this function: