cleanup
This commit is contained in:
parent
4e0c425fa0
commit
2943270bbd
@ -161,7 +161,7 @@ impl Function {
|
|||||||
self.max_x = max_x;
|
self.max_x = max_x;
|
||||||
self.pixel_width = pixel_width;
|
self.pixel_width = pixel_width;
|
||||||
} else if ((min_x != self.min_x) | (max_x != self.max_x)) && self.back_cache.is_some() {
|
} else if ((min_x != self.min_x) | (max_x != self.max_x)) && self.back_cache.is_some() {
|
||||||
debug_log("back_cache: partial regen");
|
// debug_log("back_cache: partial regen");
|
||||||
let range_new: f64 = max_x.abs() + min_x.abs();
|
let range_new: f64 = max_x.abs() + min_x.abs();
|
||||||
|
|
||||||
let resolution: f64 = (self.pixel_width as f64 / range_new) as f64;
|
let resolution: f64 = (self.pixel_width as f64 / range_new) as f64;
|
||||||
@ -207,11 +207,11 @@ impl Function {
|
|||||||
pub fn run(&mut self) -> FunctionOutput {
|
pub fn run(&mut self) -> FunctionOutput {
|
||||||
let front_values: Vec<Value> = match self.back_cache.is_some() {
|
let front_values: Vec<Value> = match self.back_cache.is_some() {
|
||||||
true => {
|
true => {
|
||||||
debug_log("back_cache: using");
|
// debug_log("back_cache: using");
|
||||||
self.back_cache.as_ref().expect("").clone()
|
self.back_cache.as_ref().expect("").clone()
|
||||||
}
|
}
|
||||||
false => {
|
false => {
|
||||||
debug_log("back_cache: regen");
|
// debug_log("back_cache: regen");
|
||||||
let absrange = (self.max_x - self.min_x).abs();
|
let absrange = (self.max_x - self.min_x).abs();
|
||||||
let resolution: f64 = (self.pixel_width as f64 / absrange) as f64;
|
let resolution: f64 = (self.pixel_width as f64 / absrange) as f64;
|
||||||
let front_data: Vec<Value> = (1..=self.pixel_width)
|
let front_data: Vec<Value> = (1..=self.pixel_width)
|
||||||
@ -229,13 +229,13 @@ impl Function {
|
|||||||
if self.integral {
|
if self.integral {
|
||||||
let back_bars: (Vec<Bar>, f64) = match self.front_cache.is_some() {
|
let back_bars: (Vec<Bar>, f64) = match self.front_cache.is_some() {
|
||||||
true => {
|
true => {
|
||||||
debug_log("front_cache: using");
|
// debug_log("front_cache: using");
|
||||||
let cache = self.front_cache.as_ref().expect("");
|
let cache = self.front_cache.as_ref().expect("");
|
||||||
let vec_bars: Vec<Bar> = cache.0.to_vec();
|
let vec_bars: Vec<Bar> = cache.0.to_vec();
|
||||||
(vec_bars, cache.1)
|
(vec_bars, cache.1)
|
||||||
}
|
}
|
||||||
false => {
|
false => {
|
||||||
debug_log("front_cache: regen");
|
// debug_log("front_cache: regen");
|
||||||
let (data, area) = self.integral_rectangles();
|
let (data, area) = self.integral_rectangles();
|
||||||
let bars: Vec<Bar> = data.iter().map(|(x, y)| Bar::new(*x, *y)).collect();
|
let bars: Vec<Bar> = data.iter().map(|(x, y)| Bar::new(*x, *y)).collect();
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,7 @@ pub fn log_helper(s: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn debug_log(s: &str) {
|
pub fn debug_log(s: &str) {
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
log(s);
|
log(s);
|
||||||
@ -30,6 +31,7 @@ pub fn debug_log(s: &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn debug_log(_s: &str) {}
|
pub fn debug_log(_s: &str) {}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user