Skip to content

Commit

Permalink
Change precision value used to distinguish between two contiguous bands
Browse files Browse the repository at this point in the history
  • Loading branch information
mthh committed Mar 11, 2024
1 parent 55c0ab6 commit d36a29f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/isobands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ pub(crate) struct Settings {
pub max_v: f64,
}

static PRECISION: f64 = f64::MIN_POSITIVE;
static PRECISION: f64 = 1e-13;

/// Contours generator, using builder pattern, to
/// be used on a rectangular `Slice` of values to
Expand Down
34 changes: 21 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,27 @@ mod tests {
assert_eq!(
res[0].0,
vec![
vec![
Point::new(0.9999999999999749, 1.0),
Point::new(1.0, 0.9999999999999749),
Point::new(2.0, 0.9999999999999749),
Point::new(3.0, 0.9999999999999749),
Point::new(4.0, 0.9999999999999749),
Point::new(5.0, 0.9999999999999749),
Point::new(5.000000000000025, 1.0),
Point::new(5.000000000000025, 2.0),
Point::new(5.000000000000025, 3.0),
Point::new(5.000000000000025, 4.0),
Point::new(5.0, 4.000000000000025),
Point::new(4.0, 4.000000000000025),
Point::new(3.0, 4.000000000000025),
Point::new(2.0, 4.000000000000025),
Point::new(1.0, 4.000000000000025),
Point::new(0.9999999999999749, 4.0),
Point::new(0.9999999999999749, 3.0),
Point::new(0.9999999999999749, 2.0),
Point::new(0.9999999999999749, 1.0),
],
vec![
Point::new(1.0, 0.5),
Point::new(0.5, 1.0),
Expand All @@ -466,19 +487,6 @@ mod tests {
Point::new(3.0, 0.5),
Point::new(2.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),
]
]
);
Expand Down

0 comments on commit d36a29f

Please sign in to comment.