Skip to content

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

Rusted Physics

Modern 2D mechanics problem drawing, Free-Body Diagram studio, and headless simulation CLI in Rust (f64 sub-stepped XPBD).

Repository: github.com/polychroms/rusted-physics

Highlights (v0.5.0)

  • Modern Studio GUI:
    • 3 Curated Studio Themes: Slate Dark, Paper Light, and Blueprint.
    • Vector-Icon Tool Dock (15 Tools): Select & Direct Vertex/Rotation Handles (V), Ruler/Protractor (M), Box (B), Ball (C), Inclined Plane/Ramp (R), Wall/Floor (W), Custom Convex & Concave Polygon (O — Dynamic or Static Rigid, Free-Draw or Triangle/Pentagon/Hexagon/Octagon/Star/L-Bar), Fixed/Movable Pulley (P), Water/Buoyancy Tank (U), Spring/Resort (S), Pulley-Routed Cable (L), Rigid Rod (D), Pin/Angular Motor (H), Constant/Harmonic Force (F), and Launch Velocity (I).
    • Body & Fluid Density Control: Edit 2D area density $\rho = m/A$ directly in the Inspector, HUD draw strip (New ρ), World default ρ0, Right-Click presets (Cork, Wood, Ice, Water, Brick, Steel), Keep ρ lock on resize, or CLI flags --density / --fluid-density.
    • Floating Canvas HUD & Direct Manipulation: Live Free-Body Diagram vectors ($\vec{G}, \vec{N}, \vec{F}_f, \vec{T}, \vec{F}_e, \vec{F}_A, \vec{R}$), optional slope gravity decomposition ($\vec{G}_t = mg\sin\alpha$, $\vec{G}_n = mg\cos\alpha$), analytical projectile trajectory preview (apex & range), on-canvas rotation & velocity handles, right-click material presets (Ice, Wood, Steel, Rubber, Concrete), and Ctrl+D body duplication.
    • Tabbed Inspector, Scene Outliner & Live Formulas: Live equations, moments of inertia, spring natural period $T_0 = 2\pi\sqrt{m/k}$, system energy conservation & non-conservative work budget.
    • Interactive Telemetry & Phase-Space Drawer: Plot $x(t), y(t)$, $|v|(t)$, $|a|(t)$, $E_k/E_p$, Cable Tension $T(t)$ / Spring $F_e(t)$, and Phase Space ($v_x$ vs $x$) with hover crosshair, plus 1-click SVG Diagram & CSV Telemetry export.
  • 16 Built-in School Physics Presets: inclined-pulley, inclined-friction, atwood, movable-pulley, springs, resonance, table-pulley, pendulums, cradle, seesaw, projectiles, archimedes, motor-cart, billiards, polygons, blank.
  • Easy & Powerful CLI: Run headless batch experiments, export publication-grade textbook SVG diagrams & CSV time series, list presets, benchmark the solver, or self-update from GitHub.

Command-Line Usage

# Launch interactive studio GUI (optionally with preset, theme, and auto-play)
rusted-physics
rusted-physics --preset projectiles --play --theme blueprint

# List all 15 built-in school physics presets
rusted-physics presets

# Run headless physics simulation and export CSV telemetry + textbook SVG diagram
rusted-physics run --preset atwood --time 2.5 --csv atwood.csv --svg atwood.svg
rusted-physics run --preset archimedes --density Wood=1.0 --fluid-density 2.5 -t 2.0

# Render any preset or saved scene directly to a standalone textbook SVG
rusted-physics export-svg --preset archimedes -o archimedes.svg

# Run solver speed & SHM energy conservation benchmark
rusted-physics bench

# Check or install updates from GitHub Releases
rusted-physics update --check

Build & Package AppImage

cargo test
./packaging/build-appimage.sh
./dist/Rusted_Physics-0.5.0-x86_64.AppImage