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

◆ profile_distance()

float MayaFlux::Kinesis::profile_distance ( const TurningProfile a,
const TurningProfile b 
)
inlinenoexcept

Root mean square difference between two turning profiles.

Parameters
aLeft profile
bRight profile, same sample count as a
Returns
RMS angular difference in radians, or infinity if the sample counts differ

In radians, so the result is directly interpretable: a value near zero is the same shape, a value near pi is a shape bending the opposite way at every point. Profiles of different lengths are not comparable and return infinity rather than silently truncating, since a partial comparison of two shapes is not a weaker answer but a wrong one.

Definition at line 249 of file PathShape.hpp.

251{
252 if (a.turning.size() != b.turning.size() || a.turning.empty())
253 return std::numeric_limits<float>::infinity();
254
255 float acc = 0.0F;
256 for (size_t i = 0; i < a.turning.size(); ++i) {
257 const float d = a.turning[i] - b.turning[i];
258 acc += d * d;
259 }
260 return std::sqrt(acc / static_cast<float>(a.turning.size()));
261}
size_t a
size_t b

References a, and b.