fix step/resolution logic and fix accuracy issues

This commit is contained in:
Simon Gardling
2022-05-16 10:53:17 -04:00
parent bee782035e
commit 73cb36cb50
4 changed files with 4 additions and 28 deletions

View File

@@ -271,9 +271,9 @@ impl FunctionEntry {
return;
}
let step = (settings.plot_width as f64) / (settings.max_x - settings.min_x);
debug_assert!(step > 0.0);
let resolution_iter = resolution_helper(&settings.plot_width + 1, &settings.min_x, &step);
let resolution = (settings.max_x - settings.min_x) / (settings.plot_width as f64);
debug_assert!(resolution > 0.0);
let resolution_iter = step_helper(&settings.plot_width + 1, &settings.min_x, &resolution);
unsafe { assume(!resolution_iter.is_empty()) }
@@ -410,7 +410,7 @@ impl FunctionEntry {
self.invalidate_integral();
}
let threshold: f64 = step / 2.0;
let threshold: f64 = resolution / 2.0;
let x_range = settings.min_x..settings.max_x;
// Calculates extrema