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};
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`
/// vector component.
#[inline]

View File

@ -195,25 +195,25 @@ impl<N: Scalar> Into<mint::Quaternion<N>> for Quaternion<N> {
fn into(self) -> mint::Quaternion<N> {
mint::Quaternion {
v: mint::Vector3 {
x: self[0],
y: self[1],
z: self[2],
x: self[0].inlined_clone(),
y: self[1].inlined_clone(),
z: self[2].inlined_clone(),
},
s: self[3],
s: self[3].inlined_clone(),
}
}
}
#[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> {
mint::Quaternion {
v: mint::Vector3 {
x: self[0],
y: self[1],
z: self[2],
x: self[0].inlined_clone(),
y: self[1].inlined_clone(),
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::dimension::{U1, U3, U4};
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::geometry::{Point3, Quaternion, Rotation, UnitQuaternion};
impl<N: SimdRealField> Index<usize> for Quaternion<N> {
impl<N: Scalar> Index<usize> for Quaternion<N> {
type Output = N;
#[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]
fn index_mut(&mut self, i: usize) -> &mut N {
&mut self.coords[i]