nalgebra/geometry/
isometry_simba.rs

1use simba::simd::SimdValue;
2
3use crate::SimdRealField;
4
5use crate::geometry::{AbstractRotation, Isometry, Translation};
6
7impl<T: SimdRealField, R, const D: usize> SimdValue for Isometry<T, R, D>
8where
9    T::Element: SimdRealField,
10    R: SimdValue<SimdBool = T::SimdBool> + AbstractRotation<T, D>,
11    R::Element: AbstractRotation<T::Element, D>,
12{
13    type Element = Isometry<T::Element, R::Element, D>;
14    type SimdBool = T::SimdBool;
15
16    #[inline]
17    fn lanes() -> usize {
18        T::lanes()
19    }
20
21    #[inline]
22    fn splat(val: Self::Element) -> Self {
23        Isometry::from_parts(Translation::splat(val.translation), R::splat(val.rotation))
24    }
25
26    #[inline]
27    fn extract(&self, i: usize) -> Self::Element {
28        Isometry::from_parts(self.translation.extract(i), self.rotation.extract(i))
29    }
30
31    #[inline]
32    unsafe fn extract_unchecked(&self, i: usize) -> Self::Element {
33        Isometry::from_parts(
34            self.translation.extract_unchecked(i),
35            self.rotation.extract_unchecked(i),
36        )
37    }
38
39    #[inline]
40    fn replace(&mut self, i: usize, val: Self::Element) {
41        self.translation.replace(i, val.translation);
42        self.rotation.replace(i, val.rotation);
43    }
44
45    #[inline]
46    unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element) {
47        self.translation.replace_unchecked(i, val.translation);
48        self.rotation.replace_unchecked(i, val.rotation);
49    }
50
51    #[inline]
52    fn select(self, cond: Self::SimdBool, other: Self) -> Self {
53        Isometry::from_parts(
54            self.translation.select(cond, other.translation),
55            self.rotation.select(cond, other.rotation),
56        )
57    }
58}