From ddd7a392ba3ed7bc13f4a8ca24757102a69773a8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 6 Aug 2024 19:33:53 +0200 Subject: [PATCH] Add default tolerance to `Core` As per its documentation, this can be used when computing the new uniform intermediate geometry representation. I'm working on that right now, so it's hopefully going to see some use soon. --- crates/fj-core/src/core.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/fj-core/src/core.rs b/crates/fj-core/src/core.rs index 47336abcc..e1e65fc7d 100644 --- a/crates/fj-core/src/core.rs +++ b/crates/fj-core/src/core.rs @@ -2,7 +2,9 @@ //! //! See [`Core`]. -use crate::{layers::Layers, validation::ValidationConfig}; +use crate::{ + algorithms::approx::Tolerance, layers::Layers, validation::ValidationConfig, +}; /// An instance of the Fornjot core /// @@ -10,6 +12,9 @@ use crate::{layers::Layers, validation::ValidationConfig}; pub struct Core { /// The layers of data that make up the state of a core instance pub layers: Layers, + + /// Default tolerance used for intermediate geometry representation + pub default_tolerance: Tolerance, } impl Core { @@ -25,7 +30,13 @@ impl Core { } fn from_layers(layers: Layers) -> Self { - Self { layers } + let default_tolerance = Tolerance::from_scalar(0.001) + .expect("Tolerance provided is larger than zero"); + + Self { + layers, + default_tolerance, + } } }