Allow specified tolerance for NearlyEq checks

This commit is contained in:
Danny McGee
2023-10-18 00:59:37 -04:00
parent b674ee3c3a
commit cfb15613b1
2 changed files with 24 additions and 8 deletions
+1 -1
View File
@@ -161,7 +161,7 @@ impl From<Vec3> for SphericalCoords {
}
let pitch = f32::asin(-y / radius);
let heading = if (pitch - 90_f32.to_radians()).abs() < 1e-3_f32 {
let heading = if pitch.nearly_eq_within(90_f32.to_radians(), 1e-3) {
0.
} else {
f32::atan2(x, z)