This commit is contained in:
Simon Gardling 2022-03-01 10:59:11 -05:00
parent f30acff409
commit 450874d2fd
2 changed files with 7 additions and 2 deletions

View File

@ -22,19 +22,23 @@ const DEFAULT_FUNCION: &str = "x^2"; // Default function that appears when addin
flate!(static FONT_DATA: [u8] from "assets/Ubuntu-Light.ttf");
pub struct MathApp {
// Stores vector of functions
functions: Vec<Function>,
// No clue why I need this, but I do. Rust being weird I guess.
// Ideally this should be information directly accessed from `functions` but it always returns an empty string. I don't know, I've been debuging this for a while now.
// Stores vector containing the string representation of the functions. This is used because of hacky reasons
func_strs: Vec<String>,
// Min and Max range for calculating an integral
integral_min_x: f64,
integral_max_x: f64,
// Number of rectangles used to calculate integral
integral_num: usize,
// Stores whether or not the help window is open
help_open: bool,
// Stores font data that's used when displaying text
font: FontData,
}

View File

@ -187,6 +187,7 @@ impl Function {
}
// Creates and does the math for creating all the rectangles under the graph
// TODO: fix this stuff, it's half broken
fn integral_rectangles(&self) -> (Vec<(f64, f64)>, f64) {
if self.integral_min_x.is_nan() {
panic!("integral_min_x is NaN")