changes from my egui fork
This commit is contained in:
parent
2d63c1b5f7
commit
e2c2713633
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@
|
|||||||
/pkg
|
/pkg
|
||||||
/tmp
|
/tmp
|
||||||
/Cargo.lock
|
/Cargo.lock
|
||||||
|
perf.data
|
||||||
|
flamegraph.svg
|
||||||
|
|||||||
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -662,7 +662,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "eframe"
|
name = "eframe"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9"
|
source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@ -682,7 +682,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui"
|
name = "egui"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9"
|
source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"epaint",
|
"epaint",
|
||||||
@ -693,7 +693,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui-winit"
|
name = "egui-winit"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9"
|
source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arboard",
|
"arboard",
|
||||||
"egui",
|
"egui",
|
||||||
@ -706,7 +706,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "egui_glow"
|
name = "egui_glow"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9"
|
source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"egui",
|
"egui",
|
||||||
@ -726,7 +726,7 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "emath"
|
name = "emath"
|
||||||
version = "0.18.0"
|
version = "0.18.0"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9"
|
source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"libm",
|
"libm",
|
||||||
@ -736,7 +736,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "epaint"
|
name = "epaint"
|
||||||
version = "0.18.1"
|
version = "0.18.1"
|
||||||
source = "git+https://github.com/Titaniumtown/egui.git#1797df1670ae95b5da81fb99324531f6737826e9"
|
source = "git+https://github.com/Titaniumtown/egui.git#63980778541f105b139e6db0095c10a0f2ce4ad1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ab_glyph",
|
"ab_glyph",
|
||||||
"ahash",
|
"ahash",
|
||||||
@ -1845,9 +1845,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rayon-core"
|
name = "rayon-core"
|
||||||
version = "1.9.2"
|
version = "1.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f51245e1e62e1f1629cbfec37b5793bbabcaeb90f30e94d2ba03564687353e4"
|
checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-channel",
|
"crossbeam-channel",
|
||||||
"crossbeam-deque",
|
"crossbeam-deque",
|
||||||
@ -1923,7 +1923,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "ruzstd"
|
name = "ruzstd"
|
||||||
version = "0.2.4"
|
version = "0.2.4"
|
||||||
source = "git+https://github.com/Titaniumtown/zstd-rs.git?branch=ringbuffer#1b2f128459f6a899788465bc005d75f0240c9eae"
|
source = "git+https://github.com/Titaniumtown/zstd-rs.git?branch=ringbuffer#56972fa1fe8b188ad2f1f54fe1fe35d9479a2d9f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"twox-hash",
|
"twox-hash",
|
||||||
|
|||||||
@ -531,7 +531,7 @@ impl FunctionEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// return value rounded to 8 decimal places
|
// return value rounded to 8 decimal places
|
||||||
Some(crate::misc::decimal_round(integral_data.1, 8))
|
Some(emath::round_to_decimals(integral_data.1, 8))
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/lib.rs
10
src/lib.rs
@ -28,8 +28,14 @@ pub use crate::{
|
|||||||
function_entry::{FunctionEntry, Riemann},
|
function_entry::{FunctionEntry, Riemann},
|
||||||
math_app::AppSettings,
|
math_app::AppSettings,
|
||||||
misc::{
|
misc::{
|
||||||
decimal_round, format_bytes, hashed_storage_create, hashed_storage_read,
|
// decimal_round,
|
||||||
option_vec_printer, resolution_helper, step_helper, SteppedVector,
|
format_bytes,
|
||||||
|
hashed_storage_create,
|
||||||
|
hashed_storage_read,
|
||||||
|
option_vec_printer,
|
||||||
|
resolution_helper,
|
||||||
|
step_helper,
|
||||||
|
SteppedVector,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
12
src/misc.rs
12
src/misc.rs
@ -188,13 +188,13 @@ impl EguiHelper for Vec<Value> {
|
|||||||
fn to_tuple(&self) -> Vec<(f64, f64)> { self.iter().map(|ele| (ele.x, ele.y)).collect() }
|
fn to_tuple(&self) -> Vec<(f64, f64)> { self.iter().map(|ele| (ele.x, ele.y)).collect() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Rounds f64 to `n` decimal places
|
// /// Rounds f64 to `n` decimal places
|
||||||
pub fn decimal_round(x: f64, n: usize) -> f64 {
|
// pub fn decimal_round(x: f64, n: usize) -> f64 {
|
||||||
let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n
|
// let large_number: f64 = 10.0_f64.powf(n as f64); // 10^n
|
||||||
|
|
||||||
// round and devide in order to cutoff after the `n`th decimal place
|
// // round and devide in order to cutoff after the `n`th decimal place
|
||||||
(x * large_number).round() / large_number
|
// (x * large_number).round() / large_number
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Helper that assists with using newton's method of finding roots, iterating over data `data`
|
/// Helper that assists with using newton's method of finding roots, iterating over data `data`
|
||||||
/// `threshold` is the target accuracy threshold
|
/// `threshold` is the target accuracy threshold
|
||||||
|
|||||||
@ -26,26 +26,26 @@ fn stepped_vector() {
|
|||||||
assert_eq!(stepped_vector.get_index((max + 1) as f64), None);
|
assert_eq!(stepped_vector.get_index((max + 1) as f64), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Ensures [`decimal_round`] returns correct values
|
// /// Ensures [`decimal_round`] returns correct values
|
||||||
#[test]
|
// #[test]
|
||||||
fn decimal_round() {
|
// fn decimal_round() {
|
||||||
use ytbn_graphing_software::decimal_round;
|
// use ytbn_graphing_software::decimal_round;
|
||||||
|
|
||||||
assert_eq!(decimal_round(0.00001, 1), 0.0);
|
// assert_eq!(decimal_round(0.00001, 1), 0.0);
|
||||||
assert_eq!(decimal_round(0.00001, 2), 0.0);
|
// assert_eq!(decimal_round(0.00001, 2), 0.0);
|
||||||
assert_eq!(decimal_round(0.00001, 3), 0.0);
|
// assert_eq!(decimal_round(0.00001, 3), 0.0);
|
||||||
assert_eq!(decimal_round(0.00001, 4), 0.0);
|
// assert_eq!(decimal_round(0.00001, 4), 0.0);
|
||||||
assert_eq!(decimal_round(0.00001, 5), 0.00001);
|
// assert_eq!(decimal_round(0.00001, 5), 0.00001);
|
||||||
|
|
||||||
assert_eq!(decimal_round(0.12345, 1), 0.1);
|
// assert_eq!(decimal_round(0.12345, 1), 0.1);
|
||||||
assert_eq!(decimal_round(0.12345, 2), 0.12);
|
// assert_eq!(decimal_round(0.12345, 2), 0.12);
|
||||||
assert_eq!(decimal_round(0.12345, 3), 0.123);
|
// assert_eq!(decimal_round(0.12345, 3), 0.123);
|
||||||
assert_eq!(decimal_round(0.12345, 4), 0.1235); // rounds up
|
// assert_eq!(decimal_round(0.12345, 4), 0.1235); // rounds up
|
||||||
assert_eq!(decimal_round(0.12345, 5), 0.12345);
|
// assert_eq!(decimal_round(0.12345, 5), 0.12345);
|
||||||
|
|
||||||
assert_eq!(decimal_round(1.9, 0), 2.0);
|
// assert_eq!(decimal_round(1.9, 0), 2.0);
|
||||||
assert_eq!(decimal_round(1.9, 1), 1.9);
|
// assert_eq!(decimal_round(1.9, 1), 1.9);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/// Tests [`resolution_helper`] to make sure it returns expected output
|
/// Tests [`resolution_helper`] to make sure it returns expected output
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user