clippy: fix just_underscores_and_digits warnings

This commit is contained in:
Philippe Renon 2020-10-26 13:37:11 +01:00
parent cf54580fac
commit 5dff493515
3 changed files with 27 additions and 27 deletions

View File

@ -79,18 +79,18 @@ impl<N: RealField> Matrix3<N> {
/// Can be used to implement "zoom_to" functionality.
#[inline]
pub fn new_nonuniform_scaling_wrt_point(scaling: &Vector2<N>, pt: &Point2<N>) -> Self {
let _0 = N::zero();
let _1 = N::one();
let zero = N::zero();
let one = N::one();
Matrix3::new(
scaling.x,
_0,
zero,
pt.x - pt.x * scaling.x,
_0,
zero,
scaling.y,
pt.y - pt.y * scaling.y,
_0,
_0,
_1,
zero,
zero,
one,
)
}
}
@ -119,25 +119,25 @@ impl<N: RealField> Matrix4<N> {
/// Can be used to implement "zoom_to" functionality.
#[inline]
pub fn new_nonuniform_scaling_wrt_point(scaling: &Vector3<N>, pt: &Point3<N>) -> Self {
let _0 = N::zero();
let _1 = N::one();
let zero = N::zero();
let one = N::one();
Matrix4::new(
scaling.x,
_0,
_0,
zero,
zero,
pt.x - pt.x * scaling.x,
_0,
zero,
scaling.y,
_0,
zero,
pt.y - pt.y * scaling.y,
_0,
_0,
zero,
zero,
scaling.z,
pt.z - pt.z * scaling.z,
_0,
_0,
_0,
_1,
zero,
zero,
zero,
one,
)
}

View File

@ -134,9 +134,9 @@ impl<T: Normed> Unit<T> {
#[inline]
pub fn renormalize_fast(&mut self) {
let sq_norm = self.value.norm_squared();
let _3: T::Norm = crate::convert(3.0);
let _0_5: T::Norm = crate::convert(0.5);
self.value.scale_mut(_0_5 * (_3 - sq_norm));
let three: T::Norm = crate::convert(3.0);
let half: T::Norm = crate::convert(0.5);
self.value.scale_mut(half * (three - sq_norm));
}
}

View File

@ -285,13 +285,13 @@ where
// Robust matrix to quaternion transformation.
// See https://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion
let tr = rotmat[(0, 0)] + rotmat[(1, 1)] + rotmat[(2, 2)];
let _0_25: N = crate::convert(0.25);
let quarter: N = crate::convert(0.25);
let res = tr.simd_gt(N::zero()).if_else3(
|| {
let denom = (tr + N::one()).simd_sqrt() * crate::convert(2.0);
Quaternion::new(
_0_25 * denom,
quarter * denom,
(rotmat[(2, 1)] - rotmat[(1, 2)]) / denom,
(rotmat[(0, 2)] - rotmat[(2, 0)]) / denom,
(rotmat[(1, 0)] - rotmat[(0, 1)]) / denom,
@ -305,7 +305,7 @@ where
* crate::convert(2.0);
Quaternion::new(
(rotmat[(2, 1)] - rotmat[(1, 2)]) / denom,
_0_25 * denom,
quarter * denom,
(rotmat[(0, 1)] + rotmat[(1, 0)]) / denom,
(rotmat[(0, 2)] + rotmat[(2, 0)]) / denom,
)
@ -320,7 +320,7 @@ where
Quaternion::new(
(rotmat[(0, 2)] - rotmat[(2, 0)]) / denom,
(rotmat[(0, 1)] + rotmat[(1, 0)]) / denom,
_0_25 * denom,
quarter * denom,
(rotmat[(1, 2)] + rotmat[(2, 1)]) / denom,
)
},
@ -333,7 +333,7 @@ where
(rotmat[(1, 0)] - rotmat[(0, 1)]) / denom,
(rotmat[(0, 2)] + rotmat[(2, 0)]) / denom,
(rotmat[(1, 2)] + rotmat[(2, 1)]) / denom,
_0_25 * denom,
quarter * denom,
)
},
);