Graded membership of a point in a box extent.
- Parameters
-
| extent | Extent to test against |
| point | Observation, same dimension as the extent |
| metric | Supplies 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)
183
184 const double outside = std::abs(
offset) - half;
185 const double soft = (extent.
softness.size() == point.size())
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}
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.