diff --git a/crates/fj-kernel/src/validate/mod.rs b/crates/fj-kernel/src/validate/mod.rs index d7a8c19c88..30f6b97a98 100644 --- a/crates/fj-kernel/src/validate/mod.rs +++ b/crates/fj-kernel/src/validate/mod.rs @@ -75,11 +75,6 @@ pub struct ValidationConfig { /// that distance is less than the one defined in this field, can not be /// considered identical. pub identical_max_distance: Scalar, - - /// How often to sample edges when checking if they coincide. This - /// represents the number of points we check on each Edge. - /// The higher this is the more precise our validation is, and the slower it is. - pub sample_count: usize, } impl Default for ValidationConfig { @@ -92,9 +87,6 @@ impl Default for ValidationConfig { // false positives due to floating-point accuracy issues), we can // adjust it. identical_max_distance: Scalar::from_f64(5e-14), - - // This value is completely arbitrary, but seems good enough for now. - sample_count: 16, } } } diff --git a/crates/fj-kernel/src/validate/shell.rs b/crates/fj-kernel/src/validate/shell.rs index 7d43ba34bb..9a6e0ebb51 100644 --- a/crates/fj-kernel/src/validate/shell.rs +++ b/crates/fj-kernel/src/validate/shell.rs @@ -63,8 +63,12 @@ fn are_coincident( .distance_to(&sample(0.0, (&edge2, surface2))) > config.identical_max_distance; - for i in 0..config.sample_count { - let percent = i as f64 * (1.0 / config.sample_count as f64); + // Three samples (start, middle, end), are enough to detect weather lines + // and circles match. If we were to add more complicated curves, this might + // need to change. + let sample_count = 3; + for i in 0..sample_count { + let percent = i as f64 * (1.0 / sample_count as f64); let sample1 = sample(percent, (&edge1, surface1)); let sample2 = sample( if flip { 1.0 - percent } else { percent },