honeycomb_core/cmap/dim2/utils.rs
1//! [`CMap2`] utilities implementations
2
3use crate::cmap::{CMap2, DartIdType};
4use crate::geometry::CoordsFloat;
5
6use super::CMAP2_BETA;
7
8/// **Utilities**
9impl<T: CoordsFloat> CMap2<T> {
10 /// Set the value of β<sub>`I`</sub>(`dart_id`) to `new_val`.
11 pub fn set_beta<const I: u8>(&self, dart_id: DartIdType, new_val: DartIdType) {
12 self.betas[(I, dart_id)].write_atomic(new_val);
13 }
14
15 /// Set the values of the beta functions of a dart.
16 ///
17 /// # Arguments
18 ///
19 /// - `dart_id: DartIdentifier` -- ID of the dart of interest.
20 /// - `betas: [DartIdentifier; 3]` -- Value of the images as
21 /// [ β<sub>`0`</sub>(`dart_id`), β<sub>`1`</sub>(`dart_id`), β<sub>`2`</sub>(`dart_id`) ]
22 pub fn set_betas(&self, dart_id: DartIdType, [b0, b1, b2]: [DartIdType; CMAP2_BETA]) {
23 // store separately to use non-mutable methods
24 self.betas[(0, dart_id)].write_atomic(b0);
25 self.betas[(1, dart_id)].write_atomic(b1);
26 self.betas[(2, dart_id)].write_atomic(b2);
27 }
28}