1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#![allow(missing_docs)] //! Utility traits and extensions use bevy_math::Vec3; pub trait NearZero: Copy { fn is_near_zero(self) -> bool; } impl NearZero for f32 { fn is_near_zero(self) -> bool { self.abs() < f32::EPSILON } } impl NearZero for Vec3 { #[must_use] fn is_near_zero(self) -> bool { self.x.is_near_zero() && self.y.is_near_zero() && self.z.is_near_zero() } }