Merge pull request #929 from remilauzier/dev

Fix some clippy warnings and typo
This commit is contained in:
Sébastien Crozet 2021-07-08 09:44:43 +02:00 committed by GitHub
commit a66b54a015
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 82 additions and 87 deletions

View File

@ -38,7 +38,7 @@ conversions targeting the versions 0.13, 0.14, and 0.15 of `glam`.
Fix a regression introduced in 0.26.0 preventing `DVector` from being serialized with `serde`. Fix a regression introduced in 0.26.0 preventing `DVector` from being serialized with `serde`.
## [0.26.0] ## [0.26.0]
This releases integrates `min-const-generics` to nalgebra. See This release integrates `min-const-generics` to nalgebra. See
[our blog post](https://www.dimforge.com/blog/2021/04/12/integrating-const-generics-to-nalgebra) [our blog post](https://www.dimforge.com/blog/2021/04/12/integrating-const-generics-to-nalgebra)
for details about this release. for details about this release.
@ -78,7 +78,7 @@ for details about this release.
## [0.25.3] ## [0.25.3]
### Added ### Added
- The `Vector::simd_cap_magnitude` method to cap the magnitude of the a vector with - The `Vector::simd_cap_magnitude` method to cap the magnitude of the vector with
SIMD components. SIMD components.
## [0.25.2] ## [0.25.2]
@ -109,7 +109,7 @@ This updates all the dependencies of nalgebra to their latest version, including
### New crate: nalgebra-sparse ### New crate: nalgebra-sparse
Alongside this release of `nalgebra`, we are releasing `nalgebra-sparse`: a crate dedicated to sparse matrix Alongside this release of `nalgebra`, we are releasing `nalgebra-sparse`: a crate dedicated to sparse matrix
computation with `nalgebra`. The `sparse` module of `nalgebra`itself still exists for backward compatibility computation with `nalgebra`. The `sparse` module of `nalgebra`itself still exists for backward compatibility,
but it will be deprecated soon in favor of the `nalgebra-sparse` crate. but it will be deprecated soon in favor of the `nalgebra-sparse` crate.
### Added ### Added
@ -125,12 +125,12 @@ but it will be deprecated soon in favor of the `nalgebra-sparse` crate.
## [0.24.0] ## [0.24.0]
### Added ### Added
* The `DualQuaternion` type. It is still work-in-progress but the basics are here: * The `DualQuaternion` type. It is still work-in-progress, but the basics are here:
creation from its real and dual part, multiplication of two dual quaternions, creation from its real and dual part, multiplication of two dual quaternions,
and normalization. and normalization.
### Removed ### Removed
* There is no blanket `impl<T> PartialEq for Unit<T>` any more. Instead, it is * There is no blanket `impl<T> PartialEq for Unit<T>` anymore. Instead, it is
implemented specifically for `UnitComplex`, `UnitQuaternion` and `Unit<Vector>`. implemented specifically for `UnitComplex`, `UnitQuaternion` and `Unit<Vector>`.
## [0.23.2] ## [0.23.2]
@ -157,7 +157,7 @@ In this release we improved the documentation of the matrix and vector types by:
and `Vector.apply(f)`. and `Vector.apply(f)`.
* The `Quaternion::from([N; 4])` conversion to build a quaternion from an array of four elements. * The `Quaternion::from([N; 4])` conversion to build a quaternion from an array of four elements.
* The `Isometry::from(Translation)` conversion to build an isometry from a translation. * The `Isometry::from(Translation)` conversion to build an isometry from a translation.
* The `Vector::ith_axis(i)` which build a unit vector, e.g., `Unit<Vector3<f32>>` with its i-th component set to 1.0 and the * The `Vector::ith_axis(i)` which build a unit vector, e.g., `Unit<Vector3<f32>>` with its i-th component set to 1.0, and the
others set to zero. others set to zero.
* The `Isometry.lerp_slerp` and `Isometry.try_lerp_slerp` methods to interpolate between two isometries using linear * The `Isometry.lerp_slerp` and `Isometry.try_lerp_slerp` methods to interpolate between two isometries using linear
interpolation for the translational part, and spherical interpolation for the rotational part. interpolation for the translational part, and spherical interpolation for the rotational part.
@ -166,7 +166,7 @@ In this release we improved the documentation of the matrix and vector types by:
## [0.22.0] ## [0.22.0]
In this release, we are using the new version 0.2 of simba. One major change of that version is that the In this release, we are using the new version 0.2 of simba. One major change of that version is that the
use of `libm` is now opt-in when building targetting `no-std` environment. If you are using floating-point use of `libm` is now opt-in when building targeting `no-std` environment. If you are using floating-point
operations with nalgebra in a `no-std` environment, you will need to enable the new `libm` feature operations with nalgebra in a `no-std` environment, you will need to enable the new `libm` feature
of nalgebra for your code to compile again. of nalgebra for your code to compile again.
@ -174,7 +174,7 @@ of nalgebra for your code to compile again.
* The `libm` feature that enables `libm` when building for `no-std` environment. * The `libm` feature that enables `libm` when building for `no-std` environment.
* The `libm-force` feature that enables `libm` even when building for a not `no-std` environment. * The `libm-force` feature that enables `libm` even when building for a not `no-std` environment.
* `Cholesky::new_unchecked` which build a Cholesky decomposition without checking that its input is * `Cholesky::new_unchecked` which build a Cholesky decomposition without checking that its input is
positive-definite. It can be use with SIMD types. positive-definite. It can be used with SIMD types.
* The `Default` trait is now implemented for matrices, and quaternions. They are all filled with zeros, * The `Default` trait is now implemented for matrices, and quaternions. They are all filled with zeros,
except for `UnitQuaternion` which is initialized with the identity. except for `UnitQuaternion` which is initialized with the identity.
* Matrix exponential `matrix.exp()`. * Matrix exponential `matrix.exp()`.
@ -345,7 +345,7 @@ library (i.e. it supports `#![no_std]`). See the corresponding [documentation](h
* Add methods `.rotation_between_axis(...)` and `.scaled_rotation_between_axis(...)` to `UnitComplex` * Add methods `.rotation_between_axis(...)` and `.scaled_rotation_between_axis(...)` to `UnitComplex`
to compute the rotation matrix between two 2D **unit** vectors. to compute the rotation matrix between two 2D **unit** vectors.
* Add methods `.axis_angle()` to `UnitComplex` and `UnitQuaternion` in order to retrieve both the * Add methods `.axis_angle()` to `UnitComplex` and `UnitQuaternion` in order to retrieve both the
unit rotation axis and the rotation angle simultaneously. unit rotation axis, and the rotation angle simultaneously.
* Add functions to construct a random matrix with a user-defined distribution: `::from_distribution(...)`. * Add functions to construct a random matrix with a user-defined distribution: `::from_distribution(...)`.
## [0.14.0] ## [0.14.0]
@ -366,7 +366,7 @@ library (i.e. it supports `#![no_std]`). See the corresponding [documentation](h
the matrix `M` such that for all vector `v` we have the matrix `M` such that for all vector `v` we have
`M * v == self.cross(&v)`. `M * v == self.cross(&v)`.
* `.iamin()` that returns the index of the vector entry with * `.iamin()` that returns the index of the vector entry with
smallest absolute value. the smallest absolute value.
* The `mint` feature that can be enabled in order to allow conversions from * The `mint` feature that can be enabled in order to allow conversions from
and to types of the [mint](https://crates.io/crates/mint) crate. and to types of the [mint](https://crates.io/crates/mint) crate.
* Aliases for matrix and vector slices. Their are named by adding `Slice` * Aliases for matrix and vector slices. Their are named by adding `Slice`
@ -404,7 +404,7 @@ This adds support for serialization using the
* The alias `MatrixNM` is now deprecated. Use `MatrixMN` instead (we * The alias `MatrixNM` is now deprecated. Use `MatrixMN` instead (we
reordered M and N to be in alphabetical order). reordered M and N to be in alphabetical order).
* In-place componentwise multiplication and division * In-place componentwise multiplication and division
`.component_mul_mut(...)` and `.component_div_mut(...)` have bee deprecated `.component_mul_mut(...)` and `.component_div_mut(...)` have been deprecated
for a future renaming. Use `.component_mul_assign(...)` and for a future renaming. Use `.component_mul_assign(...)` and
`.component_div_assign(...)` instead. `.component_div_assign(...)` instead.
@ -506,7 +506,7 @@ This version is a major rewrite of the library. Major changes are:
All other mathematical traits, except `Axpy` have been removed from All other mathematical traits, except `Axpy` have been removed from
**nalgebra**. **nalgebra**.
* Methods are now preferred to free functions because they do not require any * Methods are now preferred to free functions because they do not require any
trait to be used any more. trait to be used anymore.
* Most algebraic entities can be parametrized by type-level integers * Most algebraic entities can be parametrized by type-level integers
to specify their dimensions. Using `Dynamic` instead of a type-level to specify their dimensions. Using `Dynamic` instead of a type-level
integer indicates that the dimension known at run-time only. integer indicates that the dimension known at run-time only.
@ -582,7 +582,7 @@ only:
* The free functions `::prepend_rotation`, `::append_rotation`, * The free functions `::prepend_rotation`, `::append_rotation`,
`::append_rotation_wrt_center`, `::append_rotation_wrt_point`, `::append_rotation_wrt_center`, `::append_rotation_wrt_point`,
`::append_transformation`, and `::append_translation ` have been removed. `::append_transformation`, and `::append_translation ` have been removed.
Instead create the rotation or translation object explicitly and use Instead, create the rotation or translation object explicitly and use
multiplication to compose it with anything else. multiplication to compose it with anything else.
* The free function `::outer` has been removed. Use column-vector × * The free function `::outer` has been removed. Use column-vector ×
@ -608,7 +608,7 @@ Binary operations are now allowed between references as well. For example
### Modified ### Modified
Removed unused parameters to methods from the `ApproxEq` trait. Those were Removed unused parameters to methods from the `ApproxEq` trait. Those were
required before rust 1.0 to help type inference. The are not needed any more required before rust 1.0 to help type inference. They are not needed any more
since it now allowed to write for a type `T` that implements `ApproxEq`: since it now allowed to write for a type `T` that implements `ApproxEq`:
`<T as ApproxEq>::approx_epsilon()`. This replaces the old form: `<T as ApproxEq>::approx_epsilon()`. This replaces the old form:
`ApproxEq::approx_epsilon(None::<T>)`. `ApproxEq::approx_epsilon(None::<T>)`.
@ -627,7 +627,7 @@ since it now allowed to write for a type `T` that implements `ApproxEq`:
`UnitQuaternion::from_axisangle`. The new `::new` method now requires a `UnitQuaternion::from_axisangle`. The new `::new` method now requires a
not-normalized quaternion. not-normalized quaternion.
Methods names starting with `new_with_` now start with `from_`. This is more Method names starting with `new_with_` now start with `from_`. This is more
idiomatic in Rust. idiomatic in Rust.
The `Norm` trait now uses an associated type instead of a type parameter. The `Norm` trait now uses an associated type instead of a type parameter.
@ -658,8 +658,8 @@ crate for vectors, rotations and points. To enable them, activate the
## [0.8.0] ## [0.8.0]
### Modified ### Modified
* Almost everything (types, methods, and traits) now use full names instead * Almost everything (types, methods, and traits) now use fulls names instead
of abbreviations (e.g. `Vec3` becomes `Vector3`). Most changes are abvious. of abbreviations (e.g. `Vec3` becomes `Vector3`). Most changes are obvious.
Note however that: Note however that:
- `::sqnorm` becomes `::norm_squared`. - `::sqnorm` becomes `::norm_squared`.
- `::sqdist` becomes `::distance_squared`. - `::sqdist` becomes `::distance_squared`.
@ -693,11 +693,11 @@ you [there](https://users.nphysics.org)!
### Removed ### Removed
* Removed zero-sized elements `Vector0`, `Point0`. * Removed zero-sized elements `Vector0`, `Point0`.
* Removed 4-dimensional transformations `Rotation4` and `Isometry4` (which had an implementation to incomplete to be useful). * Removed 4-dimensional transformations `Rotation4` and `Isometry4` (which had an implementation too incomplete to be useful).
### Modified ### Modified
* Vectors are now multipliable with isometries. This will result into a pure rotation (this is how * Vectors are now multipliable with isometries. This will result into a pure rotation (this is how
vectors differ from point semantically: they design directions so they are not translatable). vectors differ from point semantically: they design directions, so they are not translatable).
* `{Isometry3, Rotation3}::look_at` reimplemented and renamed to `::look_at_rh` and `::look_at_lh` to agree * `{Isometry3, Rotation3}::look_at` reimplemented and renamed to `::look_at_rh` and `::look_at_lh` to agree
with the computer graphics community (in particular, the GLM library). Use the `::look_at_rh` with the computer graphics community (in particular, the GLM library). Use the `::look_at_rh`
variant to build a view matrix that variant to build a view matrix that

View File

@ -44,7 +44,7 @@ impl<D: Dim> DimRange<D> for usize {
#[test] #[test]
fn dimrange_usize() { fn dimrange_usize() {
assert_eq!(DimRange::contained_by(&0, Const::<0>), false); assert_eq!(DimRange::contained_by(&0, Const::<0>), false);
assert_eq!(DimRange::contained_by(&0, Const::<1>), true); assert!(DimRange::contained_by(&0, Const::<1>));
} }
impl<D: Dim> DimRange<D> for ops::Range<usize> { impl<D: Dim> DimRange<D> for ops::Range<usize> {
@ -68,24 +68,23 @@ impl<D: Dim> DimRange<D> for ops::Range<usize> {
#[test] #[test]
fn dimrange_range_usize() { fn dimrange_range_usize() {
use std::usize::MAX;
assert_eq!(DimRange::contained_by(&(0..0), Const::<0>), false); assert_eq!(DimRange::contained_by(&(0..0), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(0..1), Const::<0>), false); assert_eq!(DimRange::contained_by(&(0..1), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(0..1), Const::<1>), true); assert!(DimRange::contained_by(&(0..1), Const::<1>));
assert!(DimRange::contained_by(
&((usize::MAX - 1)..usize::MAX),
Dynamic::new(usize::MAX)
));
assert_eq!( assert_eq!(
DimRange::contained_by(&((MAX - 1)..MAX), Dynamic::new(MAX)), DimRange::length(&((usize::MAX - 1)..usize::MAX), Dynamic::new(usize::MAX)),
true
);
assert_eq!(
DimRange::length(&((MAX - 1)..MAX), Dynamic::new(MAX)),
Dynamic::new(1) Dynamic::new(1)
); );
assert_eq!( assert_eq!(
DimRange::length(&(MAX..(MAX - 1)), Dynamic::new(MAX)), DimRange::length(&(usize::MAX..(usize::MAX - 1)), Dynamic::new(usize::MAX)),
Dynamic::new(0) Dynamic::new(0)
); );
assert_eq!( assert_eq!(
DimRange::length(&(MAX..MAX), Dynamic::new(MAX)), DimRange::length(&(usize::MAX..usize::MAX), Dynamic::new(usize::MAX)),
Dynamic::new(0) Dynamic::new(0)
); );
} }
@ -111,20 +110,19 @@ impl<D: Dim> DimRange<D> for ops::RangeFrom<usize> {
#[test] #[test]
fn dimrange_rangefrom_usize() { fn dimrange_rangefrom_usize() {
use std::usize::MAX;
assert_eq!(DimRange::contained_by(&(0..), Const::<0>), false); assert_eq!(DimRange::contained_by(&(0..), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(0..), Const::<0>), false); assert_eq!(DimRange::contained_by(&(0..), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(0..), Const::<1>), true); assert!(DimRange::contained_by(&(0..), Const::<1>));
assert!(DimRange::contained_by(
&((usize::MAX - 1)..),
Dynamic::new(usize::MAX)
));
assert_eq!( assert_eq!(
DimRange::contained_by(&((MAX - 1)..), Dynamic::new(MAX)), DimRange::length(&((usize::MAX - 1)..), Dynamic::new(usize::MAX)),
true
);
assert_eq!(
DimRange::length(&((MAX - 1)..), Dynamic::new(MAX)),
Dynamic::new(1) Dynamic::new(1)
); );
assert_eq!( assert_eq!(
DimRange::length(&(MAX..), Dynamic::new(MAX)), DimRange::length(&(usize::MAX..), Dynamic::new(usize::MAX)),
Dynamic::new(0) Dynamic::new(0)
); );
} }
@ -177,7 +175,7 @@ impl<D: Dim> DimRange<D> for ops::RangeFull {
#[test] #[test]
fn dimrange_rangefull() { fn dimrange_rangefull() {
assert_eq!(DimRange::contained_by(&(..), Const::<0>), true); assert!(DimRange::contained_by(&(..), Const::<0>));
assert_eq!(DimRange::length(&(..), Const::<1>), Const::<1>); assert_eq!(DimRange::length(&(..), Const::<1>), Const::<1>);
} }
@ -206,32 +204,31 @@ impl<D: Dim> DimRange<D> for ops::RangeInclusive<usize> {
#[test] #[test]
fn dimrange_rangeinclusive_usize() { fn dimrange_rangeinclusive_usize() {
use std::usize::MAX;
assert_eq!(DimRange::contained_by(&(0..=0), Const::<0>), false); assert_eq!(DimRange::contained_by(&(0..=0), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(0..=0), Const::<1>), true); assert!(DimRange::contained_by(&(0..=0), Const::<1>));
assert_eq!( assert_eq!(
DimRange::contained_by(&(MAX..=MAX), Dynamic::new(MAX)), DimRange::contained_by(&(usize::MAX..=usize::MAX), Dynamic::new(usize::MAX)),
false false
); );
assert_eq!( assert_eq!(
DimRange::contained_by(&((MAX - 1)..=MAX), Dynamic::new(MAX)), DimRange::contained_by(&((usize::MAX - 1)..=usize::MAX), Dynamic::new(usize::MAX)),
false false
); );
assert_eq!( assert!(DimRange::contained_by(
DimRange::contained_by(&((MAX - 1)..=(MAX - 1)), Dynamic::new(MAX)), &((usize::MAX - 1)..=(usize::MAX - 1)),
true Dynamic::new(usize::MAX)
); ));
assert_eq!(DimRange::length(&(0..=0), Const::<1>), Dynamic::new(1)); assert_eq!(DimRange::length(&(0..=0), Const::<1>), Dynamic::new(1));
assert_eq!( assert_eq!(
DimRange::length(&((MAX - 1)..=MAX), Dynamic::new(MAX)), DimRange::length(&((usize::MAX - 1)..=usize::MAX), Dynamic::new(usize::MAX)),
Dynamic::new(2) Dynamic::new(2)
); );
assert_eq!( assert_eq!(
DimRange::length(&(MAX..=(MAX - 1)), Dynamic::new(MAX)), DimRange::length(&(usize::MAX..=(usize::MAX - 1)), Dynamic::new(usize::MAX)),
Dynamic::new(0) Dynamic::new(0)
); );
assert_eq!( assert_eq!(
DimRange::length(&(MAX..=MAX), Dynamic::new(MAX)), DimRange::length(&(usize::MAX..=usize::MAX), Dynamic::new(usize::MAX)),
Dynamic::new(1) Dynamic::new(1)
); );
} }
@ -257,21 +254,20 @@ impl<D: Dim> DimRange<D> for ops::RangeTo<usize> {
#[test] #[test]
fn dimrange_rangeto_usize() { fn dimrange_rangeto_usize() {
use std::usize::MAX; assert!(DimRange::contained_by(&(..0), Const::<0>));
assert_eq!(DimRange::contained_by(&(..0), Const::<0>), true);
assert_eq!(DimRange::contained_by(&(..1), Const::<0>), false); assert_eq!(DimRange::contained_by(&(..1), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(..0), Const::<1>), true); assert!(DimRange::contained_by(&(..0), Const::<1>));
assert!(DimRange::contained_by(
&(..(usize::MAX - 1)),
Dynamic::new(usize::MAX)
));
assert_eq!( assert_eq!(
DimRange::contained_by(&(..(MAX - 1)), Dynamic::new(MAX)), DimRange::length(&(..(usize::MAX - 1)), Dynamic::new(usize::MAX)),
true Dynamic::new(usize::MAX - 1)
); );
assert_eq!( assert_eq!(
DimRange::length(&(..(MAX - 1)), Dynamic::new(MAX)), DimRange::length(&(..usize::MAX), Dynamic::new(usize::MAX)),
Dynamic::new(MAX - 1) Dynamic::new(usize::MAX)
);
assert_eq!(
DimRange::length(&(..MAX), Dynamic::new(MAX)),
Dynamic::new(MAX)
); );
} }
@ -296,21 +292,20 @@ impl<D: Dim> DimRange<D> for ops::RangeToInclusive<usize> {
#[test] #[test]
fn dimrange_rangetoinclusive_usize() { fn dimrange_rangetoinclusive_usize() {
use std::usize::MAX;
assert_eq!(DimRange::contained_by(&(..=0), Const::<0>), false); assert_eq!(DimRange::contained_by(&(..=0), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(..=1), Const::<0>), false); assert_eq!(DimRange::contained_by(&(..=1), Const::<0>), false);
assert_eq!(DimRange::contained_by(&(..=0), Const::<1>), true); assert!(DimRange::contained_by(&(..=0), Const::<1>));
assert_eq!( assert_eq!(
DimRange::contained_by(&(..=(MAX)), Dynamic::new(MAX)), DimRange::contained_by(&(..=(usize::MAX)), Dynamic::new(usize::MAX)),
false false
); );
assert!(DimRange::contained_by(
&(..=(usize::MAX - 1)),
Dynamic::new(usize::MAX)
));
assert_eq!( assert_eq!(
DimRange::contained_by(&(..=(MAX - 1)), Dynamic::new(MAX)), DimRange::length(&(..=(usize::MAX - 1)), Dynamic::new(usize::MAX)),
true Dynamic::new(usize::MAX)
);
assert_eq!(
DimRange::length(&(..=(MAX - 1)), Dynamic::new(MAX)),
Dynamic::new(MAX)
); );
} }

View File

@ -102,6 +102,7 @@ pub unsafe trait Storage<T: Scalar, R: Dim, C: Dim = U1>: Debug + Sized {
/// Retrieves the data buffer as a contiguous slice. /// Retrieves the data buffer as a contiguous slice.
/// ///
/// # Safety
/// The matrix components may not be stored in a contiguous way, depending on the strides. /// The matrix components may not be stored in a contiguous way, depending on the strides.
/// This method is unsafe because this can yield to invalid aliasing when called on some pairs /// This method is unsafe because this can yield to invalid aliasing when called on some pairs
/// of matrix slices originating from the same matrix with strides. /// of matrix slices originating from the same matrix with strides.
@ -175,6 +176,7 @@ pub unsafe trait StorageMut<T: Scalar, R: Dim, C: Dim = U1>: Storage<T, R, C> {
/// ///
/// Matrix components may not be contiguous, depending on its strides. /// Matrix components may not be contiguous, depending on its strides.
/// ///
/// # Safety
/// The matrix components may not be stored in a contiguous way, depending on the strides. /// The matrix components may not be stored in a contiguous way, depending on the strides.
/// This method is unsafe because this can yield to invalid aliasing when called on some pairs /// This method is unsafe because this can yield to invalid aliasing when called on some pairs
/// of matrix slices originating from the same matrix with strides. /// of matrix slices originating from the same matrix with strides.

View File

@ -275,7 +275,7 @@ where
} }
impl<T: RealField> DualQuaternion<T> { impl<T: RealField> DualQuaternion<T> {
fn to_vector(&self) -> OVector<T, U8> { fn to_vector(self) -> OVector<T, U8> {
(*self.as_ref()).into() (*self.as_ref()).into()
} }
} }
@ -724,7 +724,7 @@ where
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_isometry(&self) -> Isometry3<T> { pub fn to_isometry(self) -> Isometry3<T> {
Isometry3::from_parts(self.translation(), self.rotation()) Isometry3::from_parts(self.translation(), self.rotation())
} }
@ -875,7 +875,7 @@ where
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_homogeneous(&self) -> Matrix4<T> { pub fn to_homogeneous(self) -> Matrix4<T> {
self.to_isometry().to_homogeneous() self.to_isometry().to_homogeneous()
} }
} }

View File

@ -222,7 +222,7 @@ impl<T: RealField> Orthographic3<T> {
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_homogeneous(&self) -> Matrix4<T> { pub fn to_homogeneous(self) -> Matrix4<T> {
self.matrix self.matrix
} }
@ -270,7 +270,7 @@ impl<T: RealField> Orthographic3<T> {
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_projective(&self) -> Projective3<T> { pub fn to_projective(self) -> Projective3<T> {
Projective3::from_matrix_unchecked(self.matrix) Projective3::from_matrix_unchecked(self.matrix)
} }

View File

@ -124,7 +124,7 @@ impl<T: RealField> Perspective3<T> {
/// Computes the corresponding homogeneous matrix. /// Computes the corresponding homogeneous matrix.
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_homogeneous(&self) -> Matrix4<T> { pub fn to_homogeneous(self) -> Matrix4<T> {
self.matrix.clone_owned() self.matrix.clone_owned()
} }
@ -145,7 +145,7 @@ impl<T: RealField> Perspective3<T> {
/// This transformation seen as a `Projective3`. /// This transformation seen as a `Projective3`.
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_projective(&self) -> Projective3<T> { pub fn to_projective(self) -> Projective3<T> {
Projective3::from_matrix_unchecked(self.matrix) Projective3::from_matrix_unchecked(self.matrix)
} }

View File

@ -1478,7 +1478,7 @@ where
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_rotation_matrix(&self) -> Rotation<T, 3> { pub fn to_rotation_matrix(self) -> Rotation<T, 3> {
let i = self.as_ref()[0]; let i = self.as_ref()[0];
let j = self.as_ref()[1]; let j = self.as_ref()[1];
let k = self.as_ref()[2]; let k = self.as_ref()[2];
@ -1513,7 +1513,7 @@ where
/// The angles are produced in the form (roll, pitch, yaw). /// The angles are produced in the form (roll, pitch, yaw).
#[inline] #[inline]
#[deprecated(note = "This is renamed to use `.euler_angles()`.")] #[deprecated(note = "This is renamed to use `.euler_angles()`.")]
pub fn to_euler_angles(&self) -> (T, T, T) pub fn to_euler_angles(self) -> (T, T, T)
where where
T: RealField, T: RealField,
{ {
@ -1561,7 +1561,7 @@ where
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_homogeneous(&self) -> Matrix4<T> { pub fn to_homogeneous(self) -> Matrix4<T> {
self.to_rotation_matrix().to_homogeneous() self.to_rotation_matrix().to_homogeneous()
} }

View File

@ -883,7 +883,7 @@ impl<T: SimdRealField> Rotation3<T> {
/// ///
/// The angles are produced in the form (roll, pitch, yaw). /// The angles are produced in the form (roll, pitch, yaw).
#[deprecated(note = "This is renamed to use `.euler_angles()`.")] #[deprecated(note = "This is renamed to use `.euler_angles()`.")]
pub fn to_euler_angles(&self) -> (T, T, T) pub fn to_euler_angles(self) -> (T, T, T)
where where
T: RealField, T: RealField,
{ {

View File

@ -261,7 +261,7 @@ where
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_rotation_matrix(&self) -> Rotation2<T> { pub fn to_rotation_matrix(self) -> Rotation2<T> {
let r = self.re; let r = self.re;
let i = self.im; let i = self.im;
@ -282,7 +282,7 @@ where
/// ``` /// ```
#[inline] #[inline]
#[must_use] #[must_use]
pub fn to_homogeneous(&self) -> Matrix3<T> { pub fn to_homogeneous(self) -> Matrix3<T> {
self.to_rotation_matrix().to_homogeneous() self.to_rotation_matrix().to_homogeneous()
} }
} }

View File

@ -31,11 +31,9 @@ impl<'a, T: Clone> Iterator for ColumnEntries<'a, T> {
if self.curr >= self.i.len() { if self.curr >= self.i.len() {
None None
} else { } else {
let res = Some( let res = Some((unsafe { *self.i.get_unchecked(self.curr) }, unsafe {
(unsafe { self.i.get_unchecked(self.curr).clone() }, unsafe { self.v.get_unchecked(self.curr).clone()
self.v.get_unchecked(self.curr).clone() }));
}),
);
self.curr += 1; self.curr += 1;
res res
} }