oxiphysics_core/interval/
boundconstraint_traits.rs1use super::functions::IntervalConstraint;
12#[allow(unused_imports)]
13use super::functions::*;
14use super::types::{BoundConstraint, Interval};
15
16impl IntervalConstraint for BoundConstraint {
17 fn propagate(&self, box_: &mut [Interval]) -> bool {
18 if let Some(narrowed) = Interval::intersection(box_[self.idx], self.bounds)
19 && (narrowed.lo > box_[self.idx].lo + 1e-15 || narrowed.hi < box_[self.idx].hi - 1e-15)
20 {
21 box_[self.idx] = narrowed;
22 return true;
23 }
24 false
25 }
26}