fix resolution_helper
This commit is contained in:
parent
3b4ccd52a5
commit
26000b06c8
@ -168,7 +168,7 @@ impl FunctionEntry {
|
|||||||
width_changed: bool, settings: AppSettings,
|
width_changed: bool, settings: AppSettings,
|
||||||
) -> f64 {
|
) -> f64 {
|
||||||
let resolution: f64 = pixel_width as f64 / (max_x.abs() + min_x.abs());
|
let resolution: f64 = pixel_width as f64 / (max_x.abs() + min_x.abs());
|
||||||
let resolution_iter = resolution_helper(pixel_width, min_x, resolution);
|
let resolution_iter = resolution_helper(pixel_width + 1, min_x, resolution);
|
||||||
|
|
||||||
// Makes sure proper arguments are passed when integral is enabled
|
// Makes sure proper arguments are passed when integral is enabled
|
||||||
if self.integral && settings.integral_changed {
|
if self.integral && settings.integral_changed {
|
||||||
|
|||||||
@ -227,7 +227,7 @@ pub fn newtons_method(
|
|||||||
// Returns a vector of length `max_i` starting at value `min_x` with resolution
|
// Returns a vector of length `max_i` starting at value `min_x` with resolution
|
||||||
// of `resolution`
|
// of `resolution`
|
||||||
pub fn resolution_helper(max_i: usize, min_x: f64, resolution: f64) -> Vec<f64> {
|
pub fn resolution_helper(max_i: usize, min_x: f64, resolution: f64) -> Vec<f64> {
|
||||||
(0..=max_i)
|
(0..max_i)
|
||||||
.map(|x| (x as f64 / resolution as f64) + min_x)
|
.map(|x| (x as f64 / resolution as f64) + min_x)
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user