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        unsafe {
30            Isometry::from_parts(
31                self.translation.extract_unchecked(i),
32                self.rotation.extract_unchecked(i),
33            )
34        }
35    }
36
37    #[inline]
38    fn replace(&mut self, i: usize, val: Self::Element) {
39        self.translation.replace(i, val.translation);
40        self.rotation.replace(i, val.rotation);
41    }
42
43    #[inline]
44    unsafe fn replace_unchecked(&mut self, i: usize, val: Self::Element) {
45        unsafe {
46            self.translation.replace_unchecked(i, val.translation);
47            self.rotation.replace_unchecked(i, val.rotation);
48        }
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}