Add Transform::is_finite (#10592)
# Objective - Sometimes it's very useful to know if a `Transform` contains any `NaN` or infinite values. It's a bit boiler-plate heavy to check translation, rotation and scale individually. ## Solution - Add a new method `is_finite` that returns true if, and only if translation, rotation and scale all are finite. - It's a natural extension of `Quat::is_finite`, and `Vec3::is_finite`, which return true if, and only if all their components' `is_finite()` returns true. --- ## Changelog - Added `Transform::is_finite`
This commit is contained in:
parent
78c255f9c9
commit
ef50b3c9f6
@ -396,6 +396,15 @@ impl Transform {
|
||||
point += self.translation;
|
||||
point
|
||||
}
|
||||
|
||||
/// Returns `true` if, and only if, translation, rotation and scale all are
|
||||
/// finite. If any of them contains a `NaN`, positive or negative infinity,
|
||||
/// this will return `false`.
|
||||
#[inline]
|
||||
#[must_use]
|
||||
pub fn is_finite(&self) -> bool {
|
||||
self.translation.is_finite() && self.rotation.is_finite() && self.scale.is_finite()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Transform {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user