Skip to main content

sim_lib_view_math/
lib.rs

1//! Math, plotting, tensor, and symbolic lenses for the SIM Web-UI (WEBUI_4).
2//!
3//! This lens family makes graphical math first-class: `scene/plot` series and
4//! function plots, `scene/matrix` editable tensor/matrix slices, a
5//! symbolic-expression tree lens, and slider/knob-driven parameter sweeps
6//! (`intent/set-param`) with snapshot and compare. Numbers are read from the
7//! existing `sim-lib-numbers-*` domains for display; the runtime value stays the
8//! authoritative number.
9//!
10//! # Example
11//!
12//! A numeric series opens in a plot lens as a Scene value:
13//!
14//! ```
15//! let scene = sim_lib_view_math::plot_view("y = x", &[(0.0, 0.0), (1.0, 1.0)]);
16//! assert!(sim_lib_scene::validate_scene(&scene).is_ok());
17//! ```
18
19#![forbid(unsafe_code)]
20#![deny(missing_docs)]
21
22pub mod matrix;
23pub mod num;
24pub mod plot;
25pub mod sweep;
26pub mod symbolic;
27
28pub use matrix::{MATRIX_LENS, cell, matrix, matrix_view, set_cell};
29pub use num::{as_f64, number, point};
30pub use plot::{PLOT_LENS, multi_plot_view, plot_view, series};
31pub use sweep::Sweep;
32pub use symbolic::{SYMBOLIC_LENS, call, symbolic_tree};
33
34/// Embedded cookbook recipe books shipped with this library.
35pub static RECIPES: sim_cookbook::EmbeddedDir =
36    include!(concat!(env!("OUT_DIR"), "/cookbook_recipes.rs"));
37
38#[cfg(test)]
39mod tests;