|
MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
|
Per-axis weighting and wrapping for a space whose axes carry different units. More...
#include <FeatureExtent.hpp>
Collaboration diagram for MayaFlux::Kinesis::FeatureMetric:Public Member Functions | |
| Eigen::VectorXd | delta (const Eigen::VectorXd &a, const Eigen::VectorXd &b) const |
| Componentwise difference, wrapped on any axis with a period. | |
| float | distance_sq (const Eigen::VectorXd &a, const Eigen::VectorXd &b) const |
| Weighted squared distance under this metric. | |
Static Public Member Functions | |
| static FeatureMetric | uniform (Eigen::Index dimensions) |
| A metric with unit weights and no wrapping. | |
Public Attributes | |
| Eigen::VectorXd | periods |
| Per-axis wrap period. Zero or empty means the axis is linear. | |
| Eigen::VectorXd | weights |
| Per-axis scale applied before differencing. Empty means unit weights. | |
Per-axis weighting and wrapping for a space whose axes carry different units.
A feature space assembled from measured quantities has no natural metric. Speed in normalized units per second, pressure in 0..1, and an angle in radians are three incommensurate axes, and Euclidean distance across them means whichever axis happens to have the largest numeric range dominates every comparison. Weights fix that by scaling each axis before the difference is taken.
Periods handle the axes that wrap. An angle at 0.01 and an angle at 6.27 are adjacent, not opposite, and no amount of weighting expresses that. A non-zero period on an axis makes its difference take the shorter way round; a zero period leaves it linear.
distance_sq has the signature SpatialIndex expects for its DistanceFn, so an index over a feature space can be constructed with this metric directly rather than defaulting to unweighted Euclidean.
Distinct from Tendency::DistanceMetric (Euclidean, Euclidean-squared, Manhattan, Chebyshev), which is a fixed choice of norm over glm::vec3 specifically, with no per-axis weighting and no wrapping. That enum answers "which norm" for a 3D world-space query. This answers "what does one unit of difference mean on each axis of an assembled feature space", which a fixed norm over three hardcoded axes cannot express.
Definition at line 57 of file FeatureExtent.hpp.