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    type Element = Rotation<T::Element, D>;
13    type SimdBool = T::SimdBool;
14
15    #[inline]
16    fn lanes() -> usize {
17        T::lanes()
18    }
19
20    #[inline]
21    fn splat(val: Self::Element) -> Self {
22        Rotation::from_matrix_unchecked(OMatrix::splat(val.into_inner()))
23    }
24
25    #[inline]
26    fn extract(&self, i: usize) -> Self::Element {
27        Rotation::from_matrix_unchecked(self.matrix().extract(i))
28    }
29
30    #[inline]
31    unsafe fn extract_unchecked(&self, i: usize) -> Self::Element {
32        Rotation::from_matrix_unchecked(self.matrix().extract_unchecked(i))
33    }
34
35    #[inline]
36    fn replace(&mut self, i: usize, val: Self::Element) {
37        self.matrix_mut_unchecked().replace(i, val.into_inner())
38    }
39
40    #[inline]
41    unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element) {
42        self.matrix_mut_unchecked()
43            .replace_unchecked(i, val.into_inner())
44    }
45
46    #[inline]
47    fn select(self, cond: Self::SimdBool, other: Self) -> Self {
48        Rotation::from_matrix_unchecked(self.into_inner().select(cond, other.into_inner()))
49    }
50}