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

◆ channel_curvature()

float MayaFlux::Kinesis::channel_curvature ( MotionChannel< glm::vec2 > &  channel)
inline

Curvature helper for MotionChannel<glm::vec2>, self-calibrating its min_speed guard from the channel's own learned noise floor.

Parameters
channelA MotionChannel<glm::vec2> that has had at least one update()
Returns
curvature(velocity, acceleration, min_speed), where min_speed is derived from the combined per-axis Estimate floors divided by dt rather than a fixed constant

A fixed min_speed constant has to assume a coordinate scale (pixels, normalized 0..1, millimeters); this instead asks "how much speed could this channel's own measurement noise alone produce", which scales automatically with whatever device and coordinate range the channel is actually receiving. Kept as a free function rather than a MotionChannel method since it is glm::vec2-specific and curvature itself does not generalize to vec3 the way velocity/acceleration do.

Definition at line 332 of file MotionChannel.hpp.

333{
334 const glm::vec2 vel = channel.derivative<1>();
335 const glm::vec2 accel = channel.derivative<2>();
336
337 const glm::vec2 floor_vec {
338 static_cast<float>(channel.estimate_for_component(0).floor()),
339 static_cast<float>(channel.estimate_for_component(1).floor())
340 };
341 const auto dt = static_cast<float>(channel.last_dt());
342 const float min_speed = (dt > 0.0F) ? (glm::length(floor_vec) / dt) : 0.0F;
343
344 return curvature(vel, accel, min_speed);
345}
double last_dt() const
dt passed to the most recent update() call
T derivative()
Compute the N-th derivative, routed through a configured HampelFilter for that order if one exists.
Stochastic::Estimate & estimate_for_component(size_t component)
Direct access to one component's Estimate instance.
double floor() const
Current learned floor.
Definition Estimate.hpp:234

References curvature(), MayaFlux::Kinesis::MotionChannel< T >::derivative(), MayaFlux::Kinesis::MotionChannel< T >::estimate_for_component(), MayaFlux::Kinesis::Stochastic::Estimate::floor(), and MayaFlux::Kinesis::MotionChannel< T >::last_dt().

+ Here is the call graph for this function: