Skip to main content

sim_lib_view_math/
lib.rs

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