Simplify trait bounds for quaternion indexing.

This commit is contained in:
Crozet Sébastien 2020-12-18 12:06:27 +01:00
parent 67603be6ed
commit ed74ff7c99
3 changed files with 13 additions and 13 deletions

View File

@ -19,7 +19,7 @@ use crate::{Scalar, SimdRealField};
use crate::geometry::{Quaternion, Rotation3, UnitQuaternion}; use crate::geometry::{Quaternion, Rotation3, UnitQuaternion};
impl<N: Scalar + SimdValue> Quaternion<N> { impl<N: Scalar> Quaternion<N> {
/// Creates a quaternion from a 4D vector. The quaternion scalar part corresponds to the `w` /// Creates a quaternion from a 4D vector. The quaternion scalar part corresponds to the `w`
/// vector component. /// vector component.
#[inline] #[inline]

View File

@ -195,25 +195,25 @@ impl<N: Scalar> Into<mint::Quaternion<N>> for Quaternion<N> {
fn into(self) -> mint::Quaternion<N> { fn into(self) -> mint::Quaternion<N> {
mint::Quaternion { mint::Quaternion {
v: mint::Vector3 { v: mint::Vector3 {
x: self[0], x: self[0].inlined_clone(),
y: self[1], y: self[1].inlined_clone(),
z: self[2], z: self[2].inlined_clone(),
}, },
s: self[3], s: self[3].inlined_clone(),
} }
} }
} }
#[cfg(feature = "mint")] #[cfg(feature = "mint")]
impl<N: Scalar> Into<mint::Quaternion<N>> for UnitQuaternion<N> { impl<N: Scalar + SimdValue> Into<mint::Quaternion<N>> for UnitQuaternion<N> {
fn into(self) -> mint::Quaternion<N> { fn into(self) -> mint::Quaternion<N> {
mint::Quaternion { mint::Quaternion {
v: mint::Vector3 { v: mint::Vector3 {
x: self[0], x: self[0].inlined_clone(),
y: self[1], y: self[1].inlined_clone(),
z: self[2], z: self[2].inlined_clone(),
}, },
s: self[3], s: self[3].inlined_clone(),
} }
} }
} }

View File

@ -57,12 +57,12 @@ use std::ops::{
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::dimension::{U1, U3, U4}; use crate::base::dimension::{U1, U3, U4};
use crate::base::storage::Storage; use crate::base::storage::Storage;
use crate::base::{DefaultAllocator, Unit, Vector, Vector3}; use crate::base::{DefaultAllocator, Scalar, Unit, Vector, Vector3};
use crate::SimdRealField; use crate::SimdRealField;
use crate::geometry::{Point3, Quaternion, Rotation, UnitQuaternion}; use crate::geometry::{Point3, Quaternion, Rotation, UnitQuaternion};
impl<N: SimdRealField> Index<usize> for Quaternion<N> { impl<N: Scalar> Index<usize> for Quaternion<N> {
type Output = N; type Output = N;
#[inline] #[inline]
@ -71,7 +71,7 @@ impl<N: SimdRealField> Index<usize> for Quaternion<N> {
} }
} }
impl<N: SimdRealField> IndexMut<usize> for Quaternion<N> { impl<N: Scalar> IndexMut<usize> for Quaternion<N> {
#[inline] #[inline]
fn index_mut(&mut self, i: usize) -> &mut N { fn index_mut(&mut self, i: usize) -> &mut N {
&mut self.coords[i] &mut self.coords[i]