isBetween static method
Check if value is inside a ND interval (bounds included).
@param value the value to check.
@param ranges the bounds (low1, high1, low2, high2, ...)
@return true
if value lies inside the interval.
Implementation
static bool isBetween(double value, List<double> ranges) {
var even = true;
for (var i = 0; i < ranges.length; i++) {
if (even) {
// lower bound
if (value < ranges[i]) {
return false;
}
} else {
// higher bound
if (value > ranges[i]) {
return false;
}
}
even = !even;
}
return true;
}