commit
81d2cbf96c
@ -530,7 +530,7 @@ pub fn perspective_lh_no<N: RealField>(aspect: N, fovy: N, near: N, far: N) -> T
|
||||
);
|
||||
assert!(
|
||||
!relative_eq!(aspect, N::zero()),
|
||||
"The apsect ratio must not be zero."
|
||||
"The aspect ratio must not be zero."
|
||||
);
|
||||
|
||||
let one = N::one();
|
||||
@ -566,7 +566,7 @@ pub fn perspective_lh_zo<N: RealField>(aspect: N, fovy: N, near: N, far: N) -> T
|
||||
);
|
||||
assert!(
|
||||
!relative_eq!(aspect, N::zero()),
|
||||
"The apsect ratio must not be zero."
|
||||
"The aspect ratio must not be zero."
|
||||
);
|
||||
|
||||
let one = N::one();
|
||||
@ -632,7 +632,7 @@ pub fn perspective_rh_no<N: RealField>(aspect: N, fovy: N, near: N, far: N) -> T
|
||||
);
|
||||
assert!(
|
||||
!relative_eq!(aspect, N::zero()),
|
||||
"The apsect ratio must not be zero."
|
||||
"The aspect ratio must not be zero."
|
||||
);
|
||||
|
||||
let negone = -N::one();
|
||||
@ -669,7 +669,7 @@ pub fn perspective_rh_zo<N: RealField>(aspect: N, fovy: N, near: N, far: N) -> T
|
||||
);
|
||||
assert!(
|
||||
!relative_eq!(aspect, N::zero()),
|
||||
"The apsect ratio must not be zero."
|
||||
"The aspect ratio must not be zero."
|
||||
);
|
||||
|
||||
let negone = -N::one();
|
||||
|
@ -363,8 +363,8 @@ where
|
||||
|
||||
while self.nrows() - i >= 8 {
|
||||
acc0 += unsafe {
|
||||
conjugate(self.get_unchecked((i + 0, j)).inlined_clone())
|
||||
* rhs.get_unchecked((i + 0, j)).inlined_clone()
|
||||
conjugate(self.get_unchecked((i, j)).inlined_clone())
|
||||
* rhs.get_unchecked((i, j)).inlined_clone()
|
||||
};
|
||||
acc1 += unsafe {
|
||||
conjugate(self.get_unchecked((i + 1, j)).inlined_clone())
|
||||
|
@ -23,7 +23,7 @@ impl Dynamic {
|
||||
/// A dynamic size equal to `value`.
|
||||
#[inline]
|
||||
pub fn new(value: usize) -> Self {
|
||||
Self { value: value }
|
||||
Self { value }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ impl<N: Scalar, R: Dim, C: Dim, S> Matrix<N, R, C, S> {
|
||||
#[inline]
|
||||
pub unsafe fn from_data_statically_unchecked(data: S) -> Matrix<N, R, C, S> {
|
||||
Matrix {
|
||||
data: data,
|
||||
data,
|
||||
_phantoms: PhantomData,
|
||||
}
|
||||
}
|
||||
|
@ -41,11 +41,7 @@ impl<N, R: Dim, C: Dim> VecStorage<N, R, C> {
|
||||
nrows.value() * ncols.value() == data.len(),
|
||||
"Data storage buffer dimension mismatch."
|
||||
);
|
||||
Self {
|
||||
data: data,
|
||||
nrows: nrows,
|
||||
ncols: ncols,
|
||||
}
|
||||
Self { data, nrows, ncols }
|
||||
}
|
||||
|
||||
/// The underlying data storage.
|
||||
|
@ -139,7 +139,7 @@ impl<N: RealField> Orthographic3<N> {
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn from_matrix_unchecked(matrix: Matrix4<N>) -> Self {
|
||||
Self { matrix: matrix }
|
||||
Self { matrix }
|
||||
}
|
||||
|
||||
/// Creates a new orthographic projection matrix from an aspect ratio and the vertical field of view.
|
||||
@ -151,7 +151,7 @@ impl<N: RealField> Orthographic3<N> {
|
||||
);
|
||||
assert!(
|
||||
!relative_eq!(aspect, N::zero()),
|
||||
"The apsect ratio must not be zero."
|
||||
"The aspect ratio must not be zero."
|
||||
);
|
||||
|
||||
let half: N = crate::convert(0.5);
|
||||
|
@ -75,7 +75,7 @@ impl<N: RealField> Perspective3<N> {
|
||||
);
|
||||
assert!(
|
||||
!relative_eq!(aspect, N::zero()),
|
||||
"The apsect ratio must not be zero."
|
||||
"The aspect ratio must not be zero."
|
||||
);
|
||||
|
||||
let matrix = Matrix4::identity();
|
||||
@ -97,7 +97,7 @@ impl<N: RealField> Perspective3<N> {
|
||||
/// projection.
|
||||
#[inline]
|
||||
pub fn from_matrix_unchecked(matrix: Matrix4<N>) -> Self {
|
||||
Self { matrix: matrix }
|
||||
Self { matrix }
|
||||
}
|
||||
|
||||
/// Retrieves the inverse of the underlying homogeneous matrix.
|
||||
@ -294,7 +294,7 @@ impl<N: RealField + Arbitrary> Arbitrary for Perspective3<N> {
|
||||
|
||||
impl<N: RealField> From<Perspective3<N>> for Matrix4<N> {
|
||||
#[inline]
|
||||
fn from(orth: Perspective3<N>) -> Self {
|
||||
orth.into_inner()
|
||||
fn from(pers: Perspective3<N>) -> Self {
|
||||
pers.into_inner()
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ where
|
||||
#[deprecated(note = "Use Point::from(vector) instead.")]
|
||||
#[inline]
|
||||
pub fn from_coordinates(coords: VectorN<N, D>) -> Self {
|
||||
Self { coords: coords }
|
||||
Self { coords }
|
||||
}
|
||||
|
||||
/// The dimension of this point.
|
||||
|
@ -492,18 +492,18 @@ where
|
||||
|
||||
// The cosinus may be out of [-1, 1] because of inaccuracies.
|
||||
if cos <= -N::one() {
|
||||
return None;
|
||||
None
|
||||
} else if cos >= N::one() {
|
||||
return Some(Self::identity());
|
||||
Some(Self::identity())
|
||||
} else {
|
||||
return Some(Self::from_axis_angle(&axis, cos.acos() * s));
|
||||
Some(Self::from_axis_angle(&axis, cos.acos() * s))
|
||||
}
|
||||
} else if na.dot(&nb) < N::zero() {
|
||||
// PI
|
||||
//
|
||||
// The rotation axis is undefined but the angle not zero. This is not a
|
||||
// simple rotation.
|
||||
return None;
|
||||
None
|
||||
} else {
|
||||
// Zero
|
||||
Some(Self::identity())
|
||||
|
@ -255,7 +255,7 @@ where
|
||||
"Unable to create a rotation from a non-square matrix."
|
||||
);
|
||||
|
||||
Self { matrix: matrix }
|
||||
Self { matrix }
|
||||
}
|
||||
|
||||
/// Transposes `self`.
|
||||
|
@ -245,7 +245,7 @@ where
|
||||
#[inline]
|
||||
pub fn from_matrix_unchecked(matrix: MatrixN<N, DimNameSum<D, U1>>) -> Self {
|
||||
Transform {
|
||||
matrix: matrix,
|
||||
matrix,
|
||||
_phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ where
|
||||
#[inline]
|
||||
#[deprecated(note = "Use `::from` instead.")]
|
||||
pub fn from_vector(vector: VectorN<N, D>) -> Translation<N, D> {
|
||||
Translation { vector: vector }
|
||||
Translation { vector }
|
||||
}
|
||||
|
||||
/// Inverts `self`.
|
||||
|
@ -60,11 +60,7 @@ where
|
||||
let mut q = PermutationSequence::identity_generic(min_nrows_ncols);
|
||||
|
||||
if min_nrows_ncols.value() == 0 {
|
||||
return Self {
|
||||
lu: matrix,
|
||||
p: p,
|
||||
q: q,
|
||||
};
|
||||
return Self { lu: matrix, p, q };
|
||||
}
|
||||
|
||||
for i in 0..min_nrows_ncols.value() {
|
||||
@ -90,11 +86,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
Self {
|
||||
lu: matrix,
|
||||
p: p,
|
||||
q: q,
|
||||
}
|
||||
Self { lu: matrix, p, q }
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
|
@ -96,7 +96,7 @@ where
|
||||
let mut p = PermutationSequence::identity_generic(min_nrows_ncols);
|
||||
|
||||
if min_nrows_ncols.value() == 0 {
|
||||
return LU { lu: matrix, p: p };
|
||||
return LU { lu: matrix, p };
|
||||
}
|
||||
|
||||
for i in 0..min_nrows_ncols.value() {
|
||||
@ -117,7 +117,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
LU { lu: matrix, p: p }
|
||||
LU { lu: matrix, p }
|
||||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
|
@ -57,20 +57,14 @@ where
|
||||
let mut diag = unsafe { MatrixMN::new_uninitialized_generic(min_nrows_ncols, U1) };
|
||||
|
||||
if min_nrows_ncols.value() == 0 {
|
||||
return QR {
|
||||
qr: matrix,
|
||||
diag: diag,
|
||||
};
|
||||
return QR { qr: matrix, diag };
|
||||
}
|
||||
|
||||
for ite in 0..min_nrows_ncols.value() {
|
||||
householder::clear_column_unchecked(&mut matrix, &mut diag[ite], ite, 0, None);
|
||||
}
|
||||
|
||||
QR {
|
||||
qr: matrix,
|
||||
diag: diag,
|
||||
}
|
||||
QR { qr: matrix, diag }
|
||||
}
|
||||
|
||||
/// Retrieves the upper trapezoidal submatrix `R` of this decomposition.
|
||||
|
@ -73,10 +73,8 @@ where
|
||||
pub fn try_new(m: MatrixN<N, D>, eps: N::RealField, max_niter: usize) -> Option<Self> {
|
||||
let mut work = unsafe { VectorN::new_uninitialized_generic(m.data.shape().0, U1) };
|
||||
|
||||
Self::do_decompose(m, &mut work, eps, max_niter, true).map(|(q, t)| Schur {
|
||||
q: q.unwrap(),
|
||||
t: t,
|
||||
})
|
||||
Self::do_decompose(m, &mut work, eps, max_niter, true)
|
||||
.map(|(q, t)| Schur { q: q.unwrap(), t })
|
||||
}
|
||||
|
||||
fn do_decompose(
|
||||
@ -138,9 +136,9 @@ where
|
||||
let m = end - 1;
|
||||
let n = end;
|
||||
|
||||
let h11 = t[(start + 0, start + 0)];
|
||||
let h12 = t[(start + 0, start + 1)];
|
||||
let h21 = t[(start + 1, start + 0)];
|
||||
let h11 = t[(start, start)];
|
||||
let h12 = t[(start, start + 1)];
|
||||
let h21 = t[(start + 1, start)];
|
||||
let h22 = t[(start + 1, start + 1)];
|
||||
let h32 = t[(start + 2, start + 1)];
|
||||
|
||||
@ -163,7 +161,7 @@ where
|
||||
|
||||
if not_zero {
|
||||
if k > start {
|
||||
t[(k + 0, k - 1)] = norm;
|
||||
t[(k, k - 1)] = norm;
|
||||
t[(k + 1, k - 1)] = N::zero();
|
||||
t[(k + 2, k - 1)] = N::zero();
|
||||
}
|
||||
|
@ -218,9 +218,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
diagonal[k + 0] = subm[(0, 0)];
|
||||
diagonal[k] = subm[(0, 0)];
|
||||
diagonal[k + 1] = subm[(1, 1)];
|
||||
off_diagonal[k + 0] = subm[(0, 1)];
|
||||
off_diagonal[k] = subm[(0, 1)];
|
||||
|
||||
if k != n - 1 {
|
||||
off_diagonal[k + 1] = subm[(1, 2)];
|
||||
@ -244,7 +244,7 @@ where
|
||||
let u2 = u2.map(|u2| GivensRotation::new_unchecked(u2.c(), N::from_real(u2.s())));
|
||||
let v2 = v2.map(|v2| GivensRotation::new_unchecked(v2.c(), N::from_real(v2.s())));
|
||||
|
||||
diagonal[start + 0] = s[0];
|
||||
diagonal[start] = s[0];
|
||||
diagonal[start + 1] = s[1];
|
||||
off_diagonal[start] = N::RealField::zero();
|
||||
|
||||
|
@ -192,7 +192,7 @@ where
|
||||
let eigvals = m.eigenvalues().unwrap();
|
||||
let basis = Vector2::new(eigvals.x - diag[start + 1], off_diag[start]);
|
||||
|
||||
diag[start + 0] = eigvals[0];
|
||||
diag[start] = eigvals[0];
|
||||
diag[start + 1] = eigvals[1];
|
||||
|
||||
if let Some(ref mut q) = q {
|
||||
|
Loading…
Reference in New Issue
Block a user