From 1c3232f830b0ff3235fa45ed7734bd7dac082e39 Mon Sep 17 00:00:00 2001 From: Matthieu Viry Date: Mon, 15 Jan 2024 17:05:27 +0100 Subject: [PATCH] Change value of precision used between two contiguous bands --- src/isobands.rs | 2 +- src/lib.rs | 36 ++++++++++++++---------------------- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/isobands.rs b/src/isobands.rs index e4cf6ea..91d4d3d 100644 --- a/src/isobands.rs +++ b/src/isobands.rs @@ -114,7 +114,7 @@ pub(crate) struct Settings { pub max_v: f64, } -static PRECISION: f64 = 1e-4; +static PRECISION: f64 = f64::MIN_POSITIVE; /// Contours generator, using builder pattern, to /// be used on a rectangular `Slice` of values to diff --git a/src/lib.rs b/src/lib.rs index 1727835..6500d4b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -446,27 +446,6 @@ mod tests { assert_eq!( res[0].0, vec![ - vec![ - Point::new(0.9999750000000001, 1.0), - Point::new(1.0, 0.9999750000000001), - Point::new(2.0, 0.9999750000000001), - Point::new(3.0, 0.9999750000000001), - Point::new(4.0, 0.9999750000000001), - Point::new(5.0, 0.9999750000000001), - Point::new(5.000025, 1.0), - Point::new(5.000025, 2.0), - Point::new(5.000025, 3.0), - Point::new(5.000025, 4.0), - Point::new(5.0, 4.000025), - Point::new(4.0, 4.000025), - Point::new(3.0, 4.000025), - Point::new(2.0, 4.000025), - Point::new(1.0, 4.000025), - Point::new(0.9999750000000001, 4.0), - Point::new(0.9999750000000001, 3.0), - Point::new(0.9999750000000001, 2.0), - Point::new(0.9999750000000001, 1.0) - ], vec![ Point::new(1.0, 0.5), Point::new(0.5, 1.0), @@ -486,7 +465,20 @@ mod tests { Point::new(4.0, 0.5), Point::new(3.0, 0.5), Point::new(2.0, 0.5), - Point::new(1.0, 0.5) + Point::new(1.0, 0.5), + ], + vec![ + Point::new(1.0, 2.0), + Point::new(2.0, 1.0), + Point::new(3.0, 1.0), + Point::new(4.0, 1.0), + Point::new(5.0, 2.0), + Point::new(5.0, 3.0), + Point::new(4.0, 4.0), + Point::new(3.0, 4.0), + Point::new(2.0, 4.0), + Point::new(1.0, 3.0), + Point::new(1.0, 2.0), ] ] );