nalgebra/geometry/
rotation_simba.rs

1use simba::simd::SimdValue;
2
3use crate::base::{OMatrix, Scalar};
4
5use crate::geometry::Rotation;
6
7impl<T, const D: usize> SimdValue for Rotation<T, D>
8where
9    T: Scalar + SimdValue,
10    T::Element: Scalar,
11{
12    const LANES: usize = T::LANES;
13    type Element = Rotation<T::Element, D>;
14    type SimdBool = T::SimdBool;
15
16    #[inline]
17    fn splat(val: Self::Element) -> Self {
18        Rotation::from_matrix_unchecked(OMatrix::splat(val.into_inner()))
19    }
20
21    #[inline]
22    fn extract(&self, i: usize) -> Self::Element {
23        Rotation::from_matrix_unchecked(self.matrix().extract(i))
24    }
25
26    #[inline]
27    unsafe fn extract_unchecked(&self, i: usize) -> Self::Element {
28        Rotation::from_matrix_unchecked(self.matrix().extract_unchecked(i))
29    }
30
31    #[inline]
32    fn replace(&mut self, i: usize, val: Self::Element) {
33        self.matrix_mut_unchecked().replace(i, val.into_inner())
34    }
35
36    #[inline]
37    unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element) {
38        self.matrix_mut_unchecked()
39            .replace_unchecked(i, val.into_inner())
40    }
41
42    #[inline]
43    fn select(self, cond: Self::SimdBool, other: Self) -> Self {
44        Rotation::from_matrix_unchecked(self.into_inner().select(cond, other.into_inner()))
45    }
46}