forgot to enable something + better debug
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::misc::debug_log;
|
||||
use eframe::egui::{plot::Value, widgets::plot::Bar};
|
||||
use meval::Expr;
|
||||
|
||||
@@ -159,10 +160,8 @@ impl Function {
|
||||
self.min_x = min_x;
|
||||
self.max_x = max_x;
|
||||
self.pixel_width = pixel_width;
|
||||
} else if ((min_x != self.min_x) | (max_x != self.max_x))
|
||||
&& self.back_cache.is_some()
|
||||
&& false
|
||||
{
|
||||
} else if ((min_x != self.min_x) | (max_x != self.max_x)) && self.back_cache.is_some() {
|
||||
debug_log("back_cache: partial regen");
|
||||
let range_new: f64 = max_x.abs() + min_x.abs();
|
||||
|
||||
let resolution: f64 = (self.pixel_width as f64 / range_new) as f64;
|
||||
@@ -207,8 +206,12 @@ impl Function {
|
||||
|
||||
pub fn run(&mut self) -> FunctionOutput {
|
||||
let front_values: Vec<Value> = match self.back_cache.is_some() {
|
||||
true => self.back_cache.as_ref().expect("").clone(),
|
||||
true => {
|
||||
debug_log("back_cache: using");
|
||||
self.back_cache.as_ref().expect("").clone()
|
||||
}
|
||||
false => {
|
||||
debug_log("back_cache: regen");
|
||||
let absrange = (self.max_x - self.min_x).abs();
|
||||
let resolution: f64 = (self.pixel_width as f64 / absrange) as f64;
|
||||
let front_data: Vec<Value> = (1..=self.pixel_width)
|
||||
@@ -226,11 +229,13 @@ impl Function {
|
||||
if self.integral {
|
||||
let back_bars: (Vec<Bar>, f64) = match self.front_cache.is_some() {
|
||||
true => {
|
||||
debug_log("front_cache: using");
|
||||
let cache = self.front_cache.as_ref().expect("");
|
||||
let vec_bars: Vec<Bar> = cache.0.to_vec();
|
||||
(vec_bars, cache.1)
|
||||
}
|
||||
false => {
|
||||
debug_log("front_cache: regen");
|
||||
let (data, area) = self.integral_rectangles();
|
||||
let bars: Vec<Bar> = data.iter().map(|(x, y)| Bar::new(*x, *y)).collect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user