fj_core/validation/
config.rs

1use fj_math::Scalar;
2
3/// Configuration required for the validation process
4#[derive(Debug, Clone, Copy)]
5pub struct ValidationConfig {
6    /// The minimum distance between distinct objects
7    ///
8    /// Objects whose distance is less than the value defined in this field, are
9    /// considered identical.
10    pub distinct_min_distance: Scalar,
11
12    /// The maximum distance between identical objects
13    ///
14    /// Objects that are considered identical might still have a distance
15    /// between them, due to inaccuracies of the numerical representation. If
16    /// that distance is less than the one defined in this field, can not be
17    /// considered identical.
18    pub identical_max_distance: Scalar,
19}
20
21impl Default for ValidationConfig {
22    fn default() -> Self {
23        Self {
24            distinct_min_distance: Scalar::from_f64(5e-7), // 0.5 µm,
25
26            // This value was chosen pretty arbitrarily. Seems small enough to
27            // catch errors. If it turns out it's too small (because it produces
28            // false positives due to floating-point accuracy issues), we can
29            // adjust it.
30            identical_max_distance: Scalar::from_f64(5e-14),
31        }
32    }
33}