1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

emath: add any_nan to Vec2, Pos2 and Rect

This commit is contained in:
Emil Ernerfeldt
2021-03-15 21:26:58 +01:00
parent 4e852727c0
commit 5621a46b4b
3 changed files with 18 additions and 0 deletions

View File

@@ -155,6 +155,11 @@ impl Vec2 {
self.x.is_finite() && self.y.is_finite()
}
/// True if any member is NaN.
pub fn any_nan(self) -> bool {
self.x.is_nan() || self.y.is_nan()
}
#[must_use]
pub fn min(self, other: Self) -> Self {
vec2(self.x.min(other.x), self.y.min(other.y))