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

◆ membership() [1/2]

double MayaFlux::Kinesis::membership ( const BoxExtent extent,
const Eigen::VectorXd &  point,
const FeatureMetric metric 
)
inline

Graded membership of a point in a box extent.

Parameters
extentExtent to test against
pointObservation, same dimension as the extent
metricSupplies wrapping; weights do not participate since the bounds are already stated in each axis's own units
Returns
1.0 fully inside, 0.0 fully outside, intermediate within the soft margin, governed by the worst axis

Definition at line 170 of file FeatureExtent.hpp.

174{
175 double worst = 1.0;
176 for (Eigen::Index i = 0; i < point.size(); ++i) {
177 const double centre = 0.5 * (extent.lower(i) + extent.upper(i));
178 const double half = 0.5 * (extent.upper(i) - extent.lower(i));
179
180 double offset = point(i) - centre;
181 if (metric.periods.size() == point.size() && metric.periods(i) > 0.0)
182 offset = std::remainder(offset, metric.periods(i));
183
184 const double outside = std::abs(offset) - half;
185 const double soft = (extent.softness.size() == point.size())
186 ? extent.softness(i)
187 : 0.0;
188
189 const double axis = (outside <= 0.0)
190 ? 1.0
191 : 1.0 - detail::ramp(0.0, std::max(soft, 1e-12), outside);
192
193 worst = std::min(worst, axis);
194 if (worst <= 0.0)
195 return 0.0;
196 }
197 return worst;
198}
glm::ivec3 max
float offset
Eigen::VectorXd softness
Outward margin per axis over which membership falls to zero. Empty means hard.
Eigen::VectorXd upper
Inclusive upper bound per axis.
Eigen::VectorXd lower
Inclusive lower bound per axis.
Eigen::VectorXd periods
Per-axis wrap period. Zero or empty means the axis is linear.

References MayaFlux::Kinesis::BoxExtent::lower, offset, MayaFlux::Kinesis::FeatureMetric::periods, MayaFlux::Kinesis::detail::ramp(), MayaFlux::Kinesis::BoxExtent::softness, and MayaFlux::Kinesis::BoxExtent::upper.

+ Here is the call graph for this function: