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