Compare commits
7 Commits
7f9a962ff7
...
abfe5480e5
| Author | SHA1 | Date | |
|---|---|---|---|
| abfe5480e5 | |||
| 31181513d0 | |||
| 7252d37763 | |||
| fe01277f7b | |||
| e96fcdbe99 | |||
| 9d96977785 | |||
| 2378f719a7 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
/Cargo.lock
|
/Cargo.lock
|
||||||
perf.data
|
perf.data
|
||||||
flamegraph.svg
|
flamegraph.svg
|
||||||
|
result
|
||||||
|
|||||||
340
Cargo.lock
generated
340
Cargo.lock
generated
@ -128,6 +128,12 @@ version = "0.7.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "as-raw-xcb-connection"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atomic-waker"
|
name = "atomic-waker"
|
||||||
version = "1.1.2"
|
version = "1.1.2"
|
||||||
@ -190,6 +196,21 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit-set"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3"
|
||||||
|
dependencies = [
|
||||||
|
"bit-vec",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bit-vec"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.3.2"
|
version = "1.3.2"
|
||||||
@ -291,6 +312,18 @@ dependencies = [
|
|||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "calloop-wayland-source"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
|
||||||
|
dependencies = [
|
||||||
|
"calloop 0.13.0",
|
||||||
|
"rustix 0.38.44",
|
||||||
|
"wayland-backend",
|
||||||
|
"wayland-client",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "calloop-wayland-source"
|
name = "calloop-wayland-source"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
@ -369,7 +402,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"unicode-width",
|
"unicode-width 0.1.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -381,6 +414,15 @@ dependencies = [
|
|||||||
"error-code",
|
"error-code",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "codespan-reporting"
|
||||||
|
version = "0.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-width 0.2.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "4.6.7"
|
version = "4.6.7"
|
||||||
@ -714,6 +756,7 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
"document-features",
|
"document-features",
|
||||||
"egui",
|
"egui",
|
||||||
|
"egui-wgpu",
|
||||||
"egui-winit",
|
"egui-winit",
|
||||||
"egui_glow",
|
"egui_glow",
|
||||||
"glow",
|
"glow",
|
||||||
@ -756,6 +799,25 @@ dependencies = [
|
|||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "egui-wgpu"
|
||||||
|
version = "0.33.2"
|
||||||
|
source = "git+https://github.com/titaniumtown/egui.git#63106bc9faab805197ba88820d6f11bc8c5c4657"
|
||||||
|
dependencies = [
|
||||||
|
"ahash",
|
||||||
|
"bytemuck",
|
||||||
|
"document-features",
|
||||||
|
"egui",
|
||||||
|
"epaint",
|
||||||
|
"log",
|
||||||
|
"profiling",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"type-map",
|
||||||
|
"web-time",
|
||||||
|
"wgpu",
|
||||||
|
"winit",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "egui-winit"
|
name = "egui-winit"
|
||||||
version = "0.33.2"
|
version = "0.33.2"
|
||||||
@ -789,6 +851,7 @@ dependencies = [
|
|||||||
"profiling",
|
"profiling",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
|
"winit",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -941,6 +1004,12 @@ dependencies = [
|
|||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "foldhash"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "foreign-types"
|
name = "foreign-types"
|
||||||
version = "0.5.0"
|
version = "0.5.0"
|
||||||
@ -1085,6 +1154,7 @@ dependencies = [
|
|||||||
"cgl",
|
"cgl",
|
||||||
"dispatch2",
|
"dispatch2",
|
||||||
"glutin_egl_sys",
|
"glutin_egl_sys",
|
||||||
|
"glutin_glx_sys",
|
||||||
"glutin_wgl_sys",
|
"glutin_wgl_sys",
|
||||||
"libloading",
|
"libloading",
|
||||||
"objc2 0.6.3",
|
"objc2 0.6.3",
|
||||||
@ -1093,7 +1163,9 @@ dependencies = [
|
|||||||
"objc2-foundation 0.3.2",
|
"objc2-foundation 0.3.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
|
"wayland-sys",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
|
"x11-dl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1118,6 +1190,16 @@ dependencies = [
|
|||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glutin_glx_sys"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185"
|
||||||
|
dependencies = [
|
||||||
|
"gl_generator",
|
||||||
|
"x11-dl",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glutin_wgl_sys"
|
name = "glutin_wgl_sys"
|
||||||
version = "0.6.1"
|
version = "0.6.1"
|
||||||
@ -1141,6 +1223,7 @@ checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"crunchy",
|
"crunchy",
|
||||||
|
"num-traits",
|
||||||
"zerocopy",
|
"zerocopy",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1149,6 +1232,9 @@ name = "hashbrown"
|
|||||||
version = "0.16.1"
|
version = "0.16.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||||
|
dependencies = [
|
||||||
|
"foldhash",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
@ -1165,6 +1251,12 @@ version = "0.5.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hexf-parse"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "iana-time-zone"
|
name = "iana-time-zone"
|
||||||
version = "0.1.64"
|
version = "0.1.64"
|
||||||
@ -1485,6 +1577,12 @@ dependencies = [
|
|||||||
"windows-link",
|
"windows-link",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libm"
|
||||||
|
version = "0.2.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libredox"
|
name = "libredox"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -1609,6 +1707,31 @@ dependencies = [
|
|||||||
"pxfm",
|
"pxfm",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "naga"
|
||||||
|
version = "27.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "066cf25f0e8b11ee0df221219010f213ad429855f57c494f995590c861a9a7d8"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"bit-set",
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"codespan-reporting",
|
||||||
|
"half 2.7.1",
|
||||||
|
"hashbrown",
|
||||||
|
"hexf-parse",
|
||||||
|
"indexmap",
|
||||||
|
"libm",
|
||||||
|
"log",
|
||||||
|
"num-traits",
|
||||||
|
"once_cell",
|
||||||
|
"rustc-hash 1.1.0",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ndk"
|
name = "ndk"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@ -1746,6 +1869,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
|
"libm",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2286,6 +2410,21 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic-util"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507"
|
||||||
|
dependencies = [
|
||||||
|
"portable-atomic",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "potential_utf"
|
name = "potential_utf"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
@ -2500,6 +2639,12 @@ version = "0.8.8"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "renderdoc-sys"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rgb"
|
name = "rgb"
|
||||||
version = "0.8.52"
|
version = "0.8.52"
|
||||||
@ -2524,6 +2669,18 @@ version = "0.1.26"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
|
checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-hash"
|
||||||
|
version = "1.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-hash"
|
||||||
|
version = "2.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.38.44"
|
version = "0.38.44"
|
||||||
@ -2718,6 +2875,31 @@ version = "1.15.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smithay-client-toolkit"
|
||||||
|
version = "0.19.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"calloop 0.13.0",
|
||||||
|
"calloop-wayland-source 0.3.0",
|
||||||
|
"cursor-icon",
|
||||||
|
"libc",
|
||||||
|
"log",
|
||||||
|
"memmap2 0.9.9",
|
||||||
|
"rustix 0.38.44",
|
||||||
|
"thiserror 1.0.69",
|
||||||
|
"wayland-backend",
|
||||||
|
"wayland-client",
|
||||||
|
"wayland-csd-frame",
|
||||||
|
"wayland-cursor",
|
||||||
|
"wayland-protocols",
|
||||||
|
"wayland-protocols-wlr",
|
||||||
|
"wayland-scanner",
|
||||||
|
"xkeysym",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smithay-client-toolkit"
|
name = "smithay-client-toolkit"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
@ -2726,7 +2908,7 @@ checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"calloop 0.14.3",
|
"calloop 0.14.3",
|
||||||
"calloop-wayland-source",
|
"calloop-wayland-source 0.4.1",
|
||||||
"cursor-icon",
|
"cursor-icon",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
@ -2752,7 +2934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
|
checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"smithay-client-toolkit",
|
"smithay-client-toolkit 0.20.0",
|
||||||
"wayland-backend",
|
"wayland-backend",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -2856,7 +3038,7 @@ version = "0.11.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-width",
|
"unicode-width 0.1.14",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3057,6 +3239,15 @@ dependencies = [
|
|||||||
"static_assertions",
|
"static_assertions",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "type-map"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90"
|
||||||
|
dependencies = [
|
||||||
|
"rustc-hash 2.1.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.19.0"
|
version = "1.19.0"
|
||||||
@ -3087,6 +3278,12 @@ version = "0.1.14"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-width"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
@ -3318,6 +3515,19 @@ dependencies = [
|
|||||||
"wayland-scanner",
|
"wayland-scanner",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wayland-protocols-plasma"
|
||||||
|
version = "0.3.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a07a14257c077ab3279987c4f8bb987851bf57081b93710381daea94f2c2c032"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"wayland-backend",
|
||||||
|
"wayland-client",
|
||||||
|
"wayland-protocols",
|
||||||
|
"wayland-scanner",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wayland-protocols-wlr"
|
name = "wayland-protocols-wlr"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@ -3396,6 +3606,102 @@ version = "0.1.12"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
|
checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu"
|
||||||
|
version = "27.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bfe68bac7cde125de7a731c3400723cadaaf1703795ad3f4805f187459cd7a77"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"document-features",
|
||||||
|
"hashbrown",
|
||||||
|
"log",
|
||||||
|
"portable-atomic",
|
||||||
|
"profiling",
|
||||||
|
"raw-window-handle",
|
||||||
|
"smallvec",
|
||||||
|
"static_assertions",
|
||||||
|
"wgpu-core",
|
||||||
|
"wgpu-hal",
|
||||||
|
"wgpu-types",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-core"
|
||||||
|
version = "27.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "27a75de515543b1897b26119f93731b385a19aea165a1ec5f0e3acecc229cae7"
|
||||||
|
dependencies = [
|
||||||
|
"arrayvec",
|
||||||
|
"bit-set",
|
||||||
|
"bit-vec",
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"bytemuck",
|
||||||
|
"cfg_aliases",
|
||||||
|
"document-features",
|
||||||
|
"hashbrown",
|
||||||
|
"indexmap",
|
||||||
|
"log",
|
||||||
|
"naga",
|
||||||
|
"once_cell",
|
||||||
|
"parking_lot",
|
||||||
|
"portable-atomic",
|
||||||
|
"profiling",
|
||||||
|
"raw-window-handle",
|
||||||
|
"rustc-hash 1.1.0",
|
||||||
|
"smallvec",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"wgpu-core-deps-windows-linux-android",
|
||||||
|
"wgpu-hal",
|
||||||
|
"wgpu-types",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-core-deps-windows-linux-android"
|
||||||
|
version = "27.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "71197027d61a71748e4120f05a9242b2ad142e3c01f8c1b47707945a879a03c3"
|
||||||
|
dependencies = [
|
||||||
|
"wgpu-hal",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-hal"
|
||||||
|
version = "27.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b21cb61c57ee198bc4aff71aeadff4cbb80b927beb912506af9c780d64313ce"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
|
"libloading",
|
||||||
|
"log",
|
||||||
|
"naga",
|
||||||
|
"portable-atomic",
|
||||||
|
"portable-atomic-util",
|
||||||
|
"raw-window-handle",
|
||||||
|
"renderdoc-sys",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"wgpu-types",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wgpu-types"
|
||||||
|
version = "27.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "afdcf84c395990db737f2dd91628706cb31e86d72e53482320d368e52b5da5eb"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.10.0",
|
||||||
|
"bytemuck",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"thiserror 2.0.17",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.9"
|
version = "0.3.9"
|
||||||
@ -3723,10 +4029,12 @@ version = "0.30.12"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732"
|
checksum = "c66d4b9ed69c4009f6321f762d6e61ad8a2389cd431b97cb1e146812e9e6c732"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"ahash",
|
||||||
"android-activity",
|
"android-activity",
|
||||||
"atomic-waker",
|
"atomic-waker",
|
||||||
"bitflags 2.10.0",
|
"bitflags 2.10.0",
|
||||||
"block2",
|
"block2",
|
||||||
|
"bytemuck",
|
||||||
"calloop 0.13.0",
|
"calloop 0.13.0",
|
||||||
"cfg_aliases",
|
"cfg_aliases",
|
||||||
"concurrent-queue",
|
"concurrent-queue",
|
||||||
@ -3736,24 +4044,33 @@ dependencies = [
|
|||||||
"dpi",
|
"dpi",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
|
"memmap2 0.9.9",
|
||||||
"ndk",
|
"ndk",
|
||||||
"objc2 0.5.2",
|
"objc2 0.5.2",
|
||||||
"objc2-app-kit 0.2.2",
|
"objc2-app-kit 0.2.2",
|
||||||
"objc2-foundation 0.2.2",
|
"objc2-foundation 0.2.2",
|
||||||
"objc2-ui-kit",
|
"objc2-ui-kit",
|
||||||
"orbclient",
|
"orbclient",
|
||||||
|
"percent-encoding",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"redox_syscall 0.4.1",
|
"redox_syscall 0.4.1",
|
||||||
"rustix 0.38.44",
|
"rustix 0.38.44",
|
||||||
|
"smithay-client-toolkit 0.19.2",
|
||||||
"smol_str",
|
"smol_str",
|
||||||
"tracing",
|
"tracing",
|
||||||
"unicode-segmentation",
|
"unicode-segmentation",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"wasm-bindgen-futures",
|
"wasm-bindgen-futures",
|
||||||
|
"wayland-backend",
|
||||||
|
"wayland-client",
|
||||||
|
"wayland-protocols",
|
||||||
|
"wayland-protocols-plasma",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
"web-time",
|
"web-time",
|
||||||
"windows-sys 0.52.0",
|
"windows-sys 0.52.0",
|
||||||
|
"x11-dl",
|
||||||
|
"x11rb",
|
||||||
"xkbcommon-dl",
|
"xkbcommon-dl",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3778,13 +4095,28 @@ version = "0.6.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "x11-dl"
|
||||||
|
version = "2.21.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"once_cell",
|
||||||
|
"pkg-config",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11rb"
|
name = "x11rb"
|
||||||
version = "0.13.2"
|
version = "0.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
|
checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"as-raw-xcb-connection",
|
||||||
"gethostname",
|
"gethostname",
|
||||||
|
"libc",
|
||||||
|
"libloading",
|
||||||
|
"once_cell",
|
||||||
"rustix 1.1.2",
|
"rustix 1.1.2",
|
||||||
"x11rb-protocol",
|
"x11rb-protocol",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -9,6 +9,10 @@ description = "Crossplatform (and web-compatible) graphing calculator"
|
|||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib", "rlib"]
|
crate-type = ["cdylib", "rlib"]
|
||||||
|
|
||||||
|
[features]
|
||||||
|
# Enable x11/wayland support for running tests on native targets
|
||||||
|
native-test = ["eframe/x11", "eframe/wayland"]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = false
|
debug = false
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
|||||||
16
TODO.md
16
TODO.md
@ -1,18 +1,20 @@
|
|||||||
## TODO:
|
## TODO:
|
||||||
1. Function management
|
1. Function management
|
||||||
- Integrals between functions (too hard to implement, maybe will shelve)
|
a. Integrals between functions (too hard to implement, maybe will shelve)
|
||||||
- Display intersection between functions (would have to rewrite a lot of the function plotting handling)
|
b. Display intersection between functions (would have to rewrite a lot of the function plotting handling)
|
||||||
- [Drag and drop support](https://github.com/emilk/egui/discussions/1530) in the UI to re-order functions
|
c. [Drag and drop support](https://github.com/emilk/egui/discussions/1530) in the UI to re-order functions
|
||||||
- Hide/disable functions
|
d. Hide/disable functions
|
||||||
- Prevent user from making too many function entries
|
e. Prevent user from making too many function entries
|
||||||
- Display function errors as tooltips or a warning box (not preventing the display of the graph)
|
f. Display function errors as tooltips or a warning box (not preventing the display of the graph)
|
||||||
- Clone functions
|
g. Clone functions
|
||||||
2. Smart display of graph
|
2. Smart display of graph
|
||||||
- Display of intersections between functions
|
- Display of intersections between functions
|
||||||
3. Allow constants in min/max integral input (like pi or euler's number)
|
3. Allow constants in min/max integral input (like pi or euler's number)
|
||||||
4. Sliding values for functions (like a user-interactable slider that adjusts a variable in the function, like desmos)
|
4. Sliding values for functions (like a user-interactable slider that adjusts a variable in the function, like desmos)
|
||||||
5. Fix integral display
|
5. Fix integral display
|
||||||
6. Better handling of roots and extrema finding
|
6. Better handling of roots and extrema finding
|
||||||
|
a. For instance, persistance, the roots shouldn't be recalculated for each movement of the viewport
|
||||||
|
b. If applicable, the roots/extrema should be expressed in terms of constants such as a root of a number, pi, or something else.
|
||||||
7. Add closing animation for function entry
|
7. Add closing animation for function entry
|
||||||
8. Fix mobile text input
|
8. Fix mobile text input
|
||||||
9. Write custom plotter
|
9. Write custom plotter
|
||||||
|
|||||||
36
flake.nix
36
flake.nix
@ -59,8 +59,42 @@
|
|||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
openssl
|
openssl
|
||||||
zstd
|
zstd
|
||||||
|
# Required for running tests with native windowing support
|
||||||
|
libxkbcommon
|
||||||
|
libGL
|
||||||
|
wayland
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libXrandr
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Run all tests on native target before building wasm
|
||||||
|
# Note: Tests run without --release because the release profile uses
|
||||||
|
# panic=abort which is incompatible with the test harness.
|
||||||
|
checkPhase =
|
||||||
|
let
|
||||||
|
libPath = pkgs.lib.makeLibraryPath (
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
libxkbcommon
|
||||||
|
libGL
|
||||||
|
wayland
|
||||||
|
xorg.libX11
|
||||||
|
xorg.libXcursor
|
||||||
|
xorg.libXi
|
||||||
|
xorg.libXrandr
|
||||||
|
]
|
||||||
|
);
|
||||||
|
in
|
||||||
|
''
|
||||||
|
runHook preCheck
|
||||||
|
export HOME=$TMPDIR
|
||||||
|
export LD_LIBRARY_PATH="${libPath}:$LD_LIBRARY_PATH"
|
||||||
|
cargo test --workspace --features native-test
|
||||||
|
runHook postCheck
|
||||||
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
@ -81,7 +115,7 @@
|
|||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Final web package with wasm-bindgen processing
|
# Final web package with wasm-bindgen processing
|
||||||
|
|||||||
@ -64,7 +64,8 @@ pub fn compile_hashmap(data: Vec<String>) -> Vec<(String, String)> {
|
|||||||
/// Returns a vector of all possible splitting combinations of a strings
|
/// Returns a vector of all possible splitting combinations of a strings
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
fn all_possible_splits(
|
fn all_possible_splits(
|
||||||
func: String, seen: &mut HashSet<(String, String)>,
|
func: String,
|
||||||
|
seen: &mut HashSet<(String, String)>,
|
||||||
) -> Vec<(String, String)> {
|
) -> Vec<(String, String)> {
|
||||||
(1..func.len())
|
(1..func.len())
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
|
|||||||
@ -60,7 +60,7 @@ impl FlatExWrapper {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
f.clone()
|
f.clone()
|
||||||
.partial_iter((0..=n).map(|_| 0))
|
.partial_iter((0..n).map(|_| 0))
|
||||||
.map(Self::new)
|
.map(Self::new)
|
||||||
.unwrap_or(Self::EMPTY)
|
.unwrap_or(Self::EMPTY)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -54,9 +54,13 @@ impl BoolSlice {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const fn is_unmasked_variable(&self) -> bool { self.variable && !self.masked_var }
|
const fn is_unmasked_variable(&self) -> bool {
|
||||||
|
self.variable && !self.masked_var
|
||||||
|
}
|
||||||
|
|
||||||
const fn is_unmasked_number(&self) -> bool { self.number && !self.masked_num }
|
const fn is_unmasked_number(&self) -> bool {
|
||||||
|
self.number && !self.masked_num
|
||||||
|
}
|
||||||
|
|
||||||
const fn calculate_mask(&mut self, other: &BoolSlice) {
|
const fn calculate_mask(&mut self, other: &BoolSlice) {
|
||||||
if other.masked_num && self.number {
|
if other.masked_num && self.number {
|
||||||
|
|||||||
@ -87,15 +87,21 @@ impl<'a> std::fmt::Debug for Hint<'a> {
|
|||||||
|
|
||||||
impl<'a> Hint<'a> {
|
impl<'a> Hint<'a> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn is_none(&self) -> bool { matches!(&self, &Hint::None) }
|
pub const fn is_none(&self) -> bool {
|
||||||
|
matches!(&self, &Hint::None)
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub const fn is_some(&self) -> bool { !self.is_none() }
|
pub const fn is_some(&self) -> bool {
|
||||||
|
!self.is_none()
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
pub const fn is_single(&self) -> bool { matches!(&self, &Hint::Single(_)) }
|
pub const fn is_single(&self) -> bool {
|
||||||
|
matches!(&self, &Hint::Single(_))
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|||||||
@ -21,6 +21,6 @@ fn main() -> eframe::Result<()> {
|
|||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"(Yet-to-be-named) Graphing Software",
|
"(Yet-to-be-named) Graphing Software",
|
||||||
eframe::NativeOptions::default(),
|
eframe::NativeOptions::default(),
|
||||||
Box::new(|cc| Box::new(math_app::MathApp::new(cc))),
|
Box::new(|cc| Ok(Box::new(math_app::MathApp::new(cc)))),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ fn do_test(sum: Riemann, area_target: f64) {
|
|||||||
if !emath::almost_equal(a[i].0 as f32, DERIVATIVE_TARGET[i].0 as f32, f32::EPSILON)
|
if !emath::almost_equal(a[i].0 as f32, DERIVATIVE_TARGET[i].0 as f32, f32::EPSILON)
|
||||||
| !emath::almost_equal(a[i].1 as f32, DERIVATIVE_TARGET[i].1 as f32, f32::EPSILON)
|
| !emath::almost_equal(a[i].1 as f32, DERIVATIVE_TARGET[i].1 as f32, f32::EPSILON)
|
||||||
{
|
{
|
||||||
panic!("Expected: {:?}\nGot: {:?}", a, DERIVATIVE_TARGET);
|
panic!("Expected: {:?}\nGot: {:?}", DERIVATIVE_TARGET, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ fn do_test(sum: Riemann, area_target: f64) {
|
|||||||
if !emath::almost_equal(a_1[i].0 as f32, BACK_TARGET[i].0 as f32, f32::EPSILON)
|
if !emath::almost_equal(a_1[i].0 as f32, BACK_TARGET[i].0 as f32, f32::EPSILON)
|
||||||
| !emath::almost_equal(a_1[i].1 as f32, BACK_TARGET[i].1 as f32, f32::EPSILON)
|
| !emath::almost_equal(a_1[i].1 as f32, BACK_TARGET[i].1 as f32, f32::EPSILON)
|
||||||
{
|
{
|
||||||
panic!("Expected: {:?}\nGot: {:?}", a_1, BACK_TARGET);
|
panic!("Expected: {:?}\nGot: {:?}", BACK_TARGET, a_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ fn do_test(sum: Riemann, area_target: f64) {
|
|||||||
if !emath::almost_equal(a[i].0 as f32, b[i].0 as f32, f32::EPSILON)
|
if !emath::almost_equal(a[i].0 as f32, b[i].0 as f32, f32::EPSILON)
|
||||||
| !emath::almost_equal(a[i].1 as f32, b[i].1 as f32, f32::EPSILON)
|
| !emath::almost_equal(a[i].1 as f32, b[i].1 as f32, f32::EPSILON)
|
||||||
{
|
{
|
||||||
panic!("Expected: {:?}\nGot: {:?}", a, b);
|
panic!("Expected: {:?}\nGot: {:?}", b, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ fn do_test(sum: Riemann, area_target: f64) {
|
|||||||
if !emath::almost_equal(a_1[i].0 as f32, b_1[i].0 as f32, f32::EPSILON)
|
if !emath::almost_equal(a_1[i].0 as f32, b_1[i].0 as f32, f32::EPSILON)
|
||||||
| !emath::almost_equal(a_1[i].1 as f32, b_1[i].1 as f32, f32::EPSILON)
|
| !emath::almost_equal(a_1[i].1 as f32, b_1[i].1 as f32, f32::EPSILON)
|
||||||
{
|
{
|
||||||
panic!("Expected: {:?}\nGot: {:?}", a_1, b_1);
|
panic!("Expected: {:?}\nGot: {:?}", b_1, a_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ fn do_test(sum: Riemann, area_target: f64) {
|
|||||||
if !emath::almost_equal(a[i].0 as f32, b[i].0 as f32, f32::EPSILON)
|
if !emath::almost_equal(a[i].0 as f32, b[i].0 as f32, f32::EPSILON)
|
||||||
| !emath::almost_equal(a[i].1 as f32, b[i].1 as f32, f32::EPSILON)
|
| !emath::almost_equal(a[i].1 as f32, b[i].1 as f32, f32::EPSILON)
|
||||||
{
|
{
|
||||||
panic!("Expected: {:?}\nGot: {:?}", a, b);
|
panic!("Expected: {:?}\nGot: {:?}", b, a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ fn do_test(sum: Riemann, area_target: f64) {
|
|||||||
if !emath::almost_equal(a_1[i].0 as f32, b_1[i].0 as f32, f32::EPSILON)
|
if !emath::almost_equal(a_1[i].0 as f32, b_1[i].0 as f32, f32::EPSILON)
|
||||||
| !emath::almost_equal(a_1[i].1 as f32, b_1[i].1 as f32, f32::EPSILON)
|
| !emath::almost_equal(a_1[i].1 as f32, b_1[i].1 as f32, f32::EPSILON)
|
||||||
{
|
{
|
||||||
panic!("Expected: {:?}\nGot: {:?}", a_1, b_1);
|
panic!("Expected: {:?}\nGot: {:?}", b_1, a_1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -271,3 +271,252 @@ fn middle_function() {
|
|||||||
fn right_function() {
|
fn right_function() {
|
||||||
do_test(Riemann::Right, 0.8800000000000001);
|
do_test(Riemann::Right, 0.8800000000000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extrema() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -2.0, 2.0, 100, 100, -2.0, 2.0);
|
||||||
|
settings.do_extrema = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^2 - 4"); // Parabola with vertex at (0, -4)
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// For f(x) = x^2 - 4, f'(x) = 2x
|
||||||
|
// Extrema occurs where f'(x) = 0, so at x = 0
|
||||||
|
assert!(!function.extrema_data.is_empty());
|
||||||
|
|
||||||
|
// Should have exactly one extremum at x = 0
|
||||||
|
assert_eq!(function.extrema_data.len(), 1);
|
||||||
|
|
||||||
|
let extremum = function.extrema_data[0];
|
||||||
|
assert!(emath::almost_equal(extremum.x as f32, 0.0, f32::EPSILON));
|
||||||
|
assert!(emath::almost_equal(extremum.y as f32, -4.0, f32::EPSILON));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extrema_multiple() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -3.0, 3.0, 200, 200, -3.0, 3.0);
|
||||||
|
settings.do_extrema = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^3 - 3*x"); // Cubic with local max and min
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// For f(x) = x^3 - 3x, f'(x) = 3x^2 - 3
|
||||||
|
// Extrema occur where f'(x) = 0, so at x = ±1
|
||||||
|
assert!(!function.extrema_data.is_empty());
|
||||||
|
|
||||||
|
// Should have exactly two extrema
|
||||||
|
assert_eq!(function.extrema_data.len(), 2);
|
||||||
|
|
||||||
|
// Sort by x coordinate for consistent testing
|
||||||
|
let mut extrema = function.extrema_data.clone();
|
||||||
|
extrema.sort_by(|a, b| a.x.partial_cmp(&b.x).unwrap());
|
||||||
|
|
||||||
|
// First extremum at x = -1, f(-1) = -1 + 3 = 2
|
||||||
|
assert!(emath::almost_equal(extrema[0].x as f32, -1.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(extrema[0].y as f32, 2.0, 0.01));
|
||||||
|
|
||||||
|
// Second extremum at x = 1, f(1) = 1 - 3 = -2
|
||||||
|
assert!(emath::almost_equal(extrema[1].x as f32, 1.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(extrema[1].y as f32, -2.0, 0.01));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extrema_disabled() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -2.0, 2.0, 100, 100, -2.0, 2.0);
|
||||||
|
settings.do_extrema = false; // Disable extrema
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^2 - 4");
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// Extrema data should be empty when disabled
|
||||||
|
assert!(function.extrema_data.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_roots() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -3.0, 3.0, 200, 200, -3.0, 3.0);
|
||||||
|
settings.do_roots = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^2 - 4"); // Parabola crossing x-axis at ±2
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// For f(x) = x^2 - 4, roots occur where x^2 = 4, so at x = ±2
|
||||||
|
assert!(!function.root_data.is_empty());
|
||||||
|
|
||||||
|
// Should have exactly two roots
|
||||||
|
assert_eq!(function.root_data.len(), 2);
|
||||||
|
|
||||||
|
// Sort by x coordinate for consistent testing
|
||||||
|
let mut roots = function.root_data.clone();
|
||||||
|
roots.sort_by(|a, b| a.x.partial_cmp(&b.x).unwrap());
|
||||||
|
|
||||||
|
// First root at x = -2
|
||||||
|
assert!(emath::almost_equal(roots[0].x as f32, -2.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(roots[0].y as f32, 0.0, 0.001));
|
||||||
|
|
||||||
|
// Second root at x = 2
|
||||||
|
assert!(emath::almost_equal(roots[1].x as f32, 2.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(roots[1].y as f32, 0.0, 0.001));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_roots_single() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -2.0, 2.0, 100, 100, -2.0, 2.0);
|
||||||
|
settings.do_roots = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x - 1"); // Linear function crossing x-axis at x = 1
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// For f(x) = x - 1, root occurs at x = 1
|
||||||
|
assert!(!function.root_data.is_empty());
|
||||||
|
|
||||||
|
// Should have exactly one root
|
||||||
|
assert_eq!(function.root_data.len(), 1);
|
||||||
|
|
||||||
|
let root = function.root_data[0];
|
||||||
|
assert!(emath::almost_equal(root.x as f32, 1.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(root.y as f32, 0.0, f32::EPSILON));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_roots_disabled() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -3.0, 3.0, 200, 200, -3.0, 3.0);
|
||||||
|
settings.do_roots = false; // Disable roots
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^2 - 4");
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// Root data should be empty when disabled
|
||||||
|
assert!(function.root_data.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extrema_and_roots_together() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -3.0, 3.0, 200, 200, -3.0, 3.0);
|
||||||
|
settings.do_extrema = true;
|
||||||
|
settings.do_roots = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^2 - 1"); // Parabola with vertex at (0, -1) and roots at ±1
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// Should have one extremum at x = 0
|
||||||
|
assert!(!function.extrema_data.is_empty());
|
||||||
|
assert_eq!(function.extrema_data.len(), 1);
|
||||||
|
let extremum = function.extrema_data[0];
|
||||||
|
assert!(emath::almost_equal(extremum.x as f32, 0.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(extremum.y as f32, -1.0, 0.01));
|
||||||
|
|
||||||
|
// Should have two roots at x = ±1
|
||||||
|
assert!(!function.root_data.is_empty());
|
||||||
|
assert_eq!(function.root_data.len(), 2);
|
||||||
|
|
||||||
|
let mut roots = function.root_data.clone();
|
||||||
|
roots.sort_by(|a, b| a.x.partial_cmp(&b.x).unwrap());
|
||||||
|
|
||||||
|
assert!(emath::almost_equal(roots[0].x as f32, -1.0, 0.01));
|
||||||
|
assert!(emath::almost_equal(roots[1].x as f32, 1.0, 0.01));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extrema_no_extrema() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -2.0, 2.0, 100, 100, -2.0, 2.0);
|
||||||
|
settings.do_extrema = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x"); // Linear function has no extrema
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// Linear function should have no extrema
|
||||||
|
assert!(function.extrema_data.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_roots_no_roots() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -2.0, 2.0, 100, 100, -2.0, 2.0);
|
||||||
|
settings.do_roots = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("x^2 + 1"); // Parabola that never crosses x-axis
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// Function that never crosses x-axis should have no roots
|
||||||
|
assert!(function.root_data.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_extrema_and_roots_with_trig() {
|
||||||
|
let mut settings = app_settings_constructor(Riemann::Middle, -4.0, 4.0, 300, 300, -4.0, 4.0);
|
||||||
|
settings.do_extrema = true;
|
||||||
|
settings.do_roots = true;
|
||||||
|
|
||||||
|
let mut function = FunctionEntry::default();
|
||||||
|
function.update_string("sin(x)"); // Sine function has extrema at odd multiples of π/2
|
||||||
|
function.integral = false;
|
||||||
|
function.derivative = false;
|
||||||
|
|
||||||
|
function.calculate(true, true, false, settings);
|
||||||
|
|
||||||
|
// Sine function should have extrema in the given range
|
||||||
|
assert!(!function.extrema_data.is_empty());
|
||||||
|
|
||||||
|
// Should have multiple extrema (local max/min)
|
||||||
|
assert!(function.extrema_data.len() >= 2);
|
||||||
|
|
||||||
|
// Check that extrema are at approximately the right locations
|
||||||
|
// Local max at π/2 ≈ 1.57, local min at 3π/2 ≈ 4.71 (outside range)
|
||||||
|
// Local min at -π/2 ≈ -1.57, local max at -3π/2 ≈ -4.71 (outside range)
|
||||||
|
let extrema_x: Vec<f32> = function.extrema_data.iter().map(|p| p.x as f32).collect();
|
||||||
|
|
||||||
|
// Should have extrema near ±π/2
|
||||||
|
assert!(extrema_x
|
||||||
|
.iter()
|
||||||
|
.any(|&x| emath::almost_equal(x, std::f32::consts::PI / 2.0, 0.1)));
|
||||||
|
assert!(extrema_x
|
||||||
|
.iter()
|
||||||
|
.any(|&x| emath::almost_equal(x, -std::f32::consts::PI / 2.0, 0.1)));
|
||||||
|
|
||||||
|
let roots_x: Vec<f32> = function.root_data.iter().map(|p| p.x as f32).collect();
|
||||||
|
|
||||||
|
assert!(roots_x
|
||||||
|
.iter()
|
||||||
|
.any(|&x| emath::almost_equal(x, std::f32::consts::PI, 0.1)));
|
||||||
|
assert!(roots_x
|
||||||
|
.iter()
|
||||||
|
.any(|&x| emath::almost_equal(x, -std::f32::consts::PI, 0.1)));
|
||||||
|
|
||||||
|
assert!(roots_x.iter().any(|&x| emath::almost_equal(x, 0.0, 0.1)));
|
||||||
|
}
|
||||||
|
|||||||
@ -152,7 +152,7 @@ fn newtons_method() {
|
|||||||
|
|
||||||
let data = newtons_method(
|
let data = newtons_method(
|
||||||
&get_flatexwrapper("x^2 -1"),
|
&get_flatexwrapper("x^2 -1"),
|
||||||
&get_flatexwrapper("2x"),
|
&get_flatexwrapper("2*x"),
|
||||||
3.0,
|
3.0,
|
||||||
&(0.0..5.0),
|
&(0.0..5.0),
|
||||||
f64::EPSILON,
|
f64::EPSILON,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user