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