comments
This commit is contained in:
parent
f30acff409
commit
450874d2fd
@ -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");
|
flate!(static FONT_DATA: [u8] from "assets/Ubuntu-Light.ttf");
|
||||||
|
|
||||||
pub struct MathApp {
|
pub struct MathApp {
|
||||||
|
// Stores vector of functions
|
||||||
functions: Vec<Function>,
|
functions: Vec<Function>,
|
||||||
|
|
||||||
// No clue why I need this, but I do. Rust being weird I guess.
|
// Stores vector containing the string representation of the functions. This is used because of hacky reasons
|
||||||
// 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.
|
|
||||||
func_strs: Vec<String>,
|
func_strs: Vec<String>,
|
||||||
|
|
||||||
|
// Min and Max range for calculating an integral
|
||||||
integral_min_x: f64,
|
integral_min_x: f64,
|
||||||
integral_max_x: f64,
|
integral_max_x: f64,
|
||||||
|
|
||||||
|
// Number of rectangles used to calculate integral
|
||||||
integral_num: usize,
|
integral_num: usize,
|
||||||
|
|
||||||
|
// Stores whether or not the help window is open
|
||||||
help_open: bool,
|
help_open: bool,
|
||||||
|
|
||||||
|
// Stores font data that's used when displaying text
|
||||||
font: FontData,
|
font: FontData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,6 +187,7 @@ impl Function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Creates and does the math for creating all the rectangles under the graph
|
// 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) {
|
fn integral_rectangles(&self) -> (Vec<(f64, f64)>, f64) {
|
||||||
if self.integral_min_x.is_nan() {
|
if self.integral_min_x.is_nan() {
|
||||||
panic!("integral_min_x is NaN")
|
panic!("integral_min_x is NaN")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user