This commit is contained in:
Simon Gardling 2022-02-23 19:43:37 -05:00
parent 66d9ff301c
commit 5cd335be89
2 changed files with 11 additions and 11 deletions

View File

@ -62,11 +62,11 @@ impl ChartManager {
pub fn do_update_back(&self, func_str_new: String, min_x: f64, max_x: f64) -> bool {
let func_str: String = add_asterisks(func_str_new);
let update_func: bool = !self.function.str_compare(func_str.clone());
let update_func: bool = !self.function.str_compare(func_str);
let underlying_update = update_func | (min_x != self.min_x) | (max_x != self.max_x);
underlying_update
update_func | (min_x != self.min_x) | (max_x != self.max_x)
}
#[allow(clippy::too_many_arguments)]
@ -116,12 +116,12 @@ impl ChartManager {
let tmp2: f64 = self.function.run(x2);
// Chooses the y value who's absolute value is the smallest
let output = match tmp2.abs() > tmp1.abs() {
match tmp2.abs() > tmp1.abs() {
true => (x2, tmp1),
false => (x, tmp2),
};
output
}
})
.filter(|(_, y)| !y.is_nan())
.collect();

View File

@ -3,7 +3,7 @@ use crate::misc::{digits_precision, test_func, Cache};
use eframe::{egui, epi};
use egui::plot::{Line, Plot, Value, Values};
use egui::widgets::plot::{Bar, BarChart};
use egui::{plot, Color32};
use egui::{Color32};
pub struct MathApp {
func_str: String,
@ -71,10 +71,10 @@ impl epi::App for MathApp {
}
let x_range = min_x_total as f64..=max_x_total as f64;
let min_x_old = min_x.clone();
let min_x_old = *min_x;
let min_x_response = ui.add(egui::Slider::new(min_x, x_range.clone()).text("Min X"));
let max_x_old = max_x.clone();
let max_x_old = *max_x;
let max_x_response = ui.add(egui::Slider::new(max_x, x_range).text("Max X"));
if min_x >= max_x {
@ -91,7 +91,7 @@ impl epi::App for MathApp {
ui.add(egui::Slider::new(num_interval, 1..=usize::MAX).text("Interval"));
});
let update_back = chart_manager.do_update_back(func_str.clone(), *min_x, *max_x);
let _update_back = chart_manager.do_update_back(func_str.clone(), *min_x, *max_x);
let update_front = chart_manager.do_update_front(*num_interval, *resolution);
egui::CentralPanel::default().show(ctx, |ui| {