Constructs the smallest AABB fitting around all the given points, parallel version
(points: &[SVector<R, D>])
| 26 | { |
| 27 | /// Constructs the smallest AABB fitting around all the given points, parallel version |
| 28 | pub fn par_from_points(points: &[SVector<R, D>]) -> Self { |
| 29 | if points.is_empty() { |
| 30 | Self::zeros() |
| 31 | } else if points.len() == 1 { |
| 32 | Self::from_point(points[0]) |
| 33 | } else { |
| 34 | let initial_aabb = Self::from_point(points[0]); |
| 35 | points[1..] |
| 36 | .par_iter() |
| 37 | .fold( |
| 38 | || initial_aabb.clone(), |
| 39 | |mut aabb, next_point| { |
| 40 | aabb.join_with_point(next_point); |
| 41 | aabb |
| 42 | }, |
| 43 | ) |
| 44 | .reduce( |
| 45 | || initial_aabb.clone(), |
| 46 | |mut final_aabb, aabb| { |
| 47 | final_aabb.join(&aabb); |
| 48 | final_aabb |
| 49 | }, |
| 50 | ) |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | impl<R, const D: usize> AxisAlignedBoundingBox<R, D> |
nothing calls this directly
no test coverage detected