fix
This commit is contained in:
parent
9afe6f514e
commit
20d8b1421c
@ -352,10 +352,12 @@ impl MathApp {
|
||||
}
|
||||
}
|
||||
|
||||
ui.add(
|
||||
let integral_num_changed = ui
|
||||
.add(
|
||||
Slider::new(&mut self.settings.integral_num, INTEGRAL_NUM_RANGE)
|
||||
.text("Interval"),
|
||||
);
|
||||
)
|
||||
.changed();
|
||||
|
||||
let functions_len = self.functions.len();
|
||||
let mut remove_i: Option<usize> = None;
|
||||
@ -407,6 +409,7 @@ impl MathApp {
|
||||
| derivative_toggle
|
||||
| max_x_changed
|
||||
| min_x_changed
|
||||
| integral_num_changed
|
||||
| (proc_func_str != function.get_func_str())
|
||||
| self.last_error.iter().any(|ele| ele.0 == i)
|
||||
{
|
||||
|
||||
@ -117,7 +117,7 @@ impl FunctionEntry {
|
||||
.into();
|
||||
|
||||
self.back_cache = Some(
|
||||
(0..=self.pixel_width)
|
||||
(0..self.pixel_width)
|
||||
.map(|x| (x as f64 / resolution as f64) + min_x)
|
||||
.map(|x| {
|
||||
if let Some(i) = x_data.get_index(x) {
|
||||
@ -128,13 +128,14 @@ impl FunctionEntry {
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
// assert_eq!(self.back_cache.as_ref().unwrap().len(), self.pixel_width);
|
||||
|
||||
if self.derivative_cache.is_some() {
|
||||
if self.derivative {
|
||||
let derivative_cache = self.derivative_cache.as_ref().unwrap();
|
||||
|
||||
self.derivative_cache = Some(
|
||||
(0..=self.pixel_width)
|
||||
(0..self.pixel_width)
|
||||
.map(|x| (x as f64 / resolution as f64) + min_x)
|
||||
.map(|x| {
|
||||
if let Some(i) = x_data.get_index(x) {
|
||||
@ -145,6 +146,7 @@ impl FunctionEntry {
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
// assert_eq!(self.derivative_cache.as_ref().unwrap().len(), self.pixel_width);
|
||||
} else {
|
||||
self.derivative_cache = None;
|
||||
}
|
||||
@ -262,6 +264,8 @@ impl FunctionEntry {
|
||||
})
|
||||
.filter(|(_, y)| !y.is_nan())
|
||||
.collect();
|
||||
// assert_eq!(data2.len(), self.integral_num);
|
||||
|
||||
(data2, area)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user