[−]Trait druid::piet::kurbo::common::FloatExt
Adds convenience methods to f32
and f64
.
Required methods
pub fn expand(&self) -> T
Rounds to the nearest integer away from zero, unless the provided value is already an integer.
It is to ceil
what trunc
is to floor
.
Examples
use kurbo::common::FloatExt; let f = 3.7_f64; let g = 3.0_f64; let h = -3.7_f64; let i = -5.1_f32; assert_eq!(f.expand(), 4.0); assert_eq!(g.expand(), 3.0); assert_eq!(h.expand(), -4.0); assert_eq!(i.expand(), -6.0);