nalgebra/geometry/
point_simba.rs

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