mirror of
https://github.com/hannobraun/Fornjot
synced 2025-09-28 12:07:54 +00:00
Add ValidationConfig::from_tolerance
This commit is contained in:
parent
710ee5ead0
commit
7515515a99
@ -39,12 +39,14 @@ pub struct ValidationConfig {
|
|||||||
pub identical_max_distance: Scalar,
|
pub identical_max_distance: Scalar,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ValidationConfig {
|
impl ValidationConfig {
|
||||||
fn default() -> Self {
|
/// Compute validation config from a tolerance value
|
||||||
|
pub fn from_tolerance(tolerance: impl Into<Tolerance>) -> Self {
|
||||||
|
let tolerance = tolerance.into();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
panic_on_error: false,
|
panic_on_error: false,
|
||||||
tolerance: Tolerance::from_scalar(0.001)
|
tolerance,
|
||||||
.expect("Tolerance provided is larger than zero"),
|
|
||||||
distinct_min_distance: Scalar::from_f64(5e-7), // 0.5 µm,
|
distinct_min_distance: Scalar::from_f64(5e-7), // 0.5 µm,
|
||||||
|
|
||||||
// This value was chosen pretty arbitrarily. Seems small enough to
|
// This value was chosen pretty arbitrarily. Seems small enough to
|
||||||
@ -55,3 +57,9 @@ impl Default for ValidationConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for ValidationConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::from_tolerance(0.001)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user