Skip to main content

Crate blast_stress_solver

Crate blast_stress_solver 

Source
Expand description

§Blast Stress Solver

Rust library wrapping the NVIDIA Blast stress solver for destructible structures.

§Features

  • Core solver: ExtStressSolver — manages nodes, bonds, actors, fracture detection and splitting
  • Low-level solver: StressProcessor — direct conjugate-gradient solver access
  • Bond stress analysis: compute_bond_stress — decompose impulses into compression/tension/shear
  • Scenarios (feature scenarios): Pre-built wall, tower, and bridge scenario builders
  • Rapier integration (feature rapier): DestructionRuntime for existing Rapier apps and DestructibleSet as the low-level escape hatch
  • Authoring (feature authoring): Auto-generate bonds from pre-fractured triangle chunks and assemble ScenarioDesc values from piece meshes

DestructionRuntime is the recommended integration point when you already own a Rapier world and want normal Rapier contacts to drive fracture while still keeping PhysicsPipeline::step(...) in your app.

§Quick Start (without Rapier)

use blast_stress_solver::*;

let nodes = vec![
    NodeDesc { centroid: Vec3::new(0.0, 0.0, 0.0), mass: 0.0, volume: 1.0 },  // support
    NodeDesc { centroid: Vec3::new(0.0, 1.0, 0.0), mass: 10.0, volume: 1.0 },  // dynamic
];
let bonds = vec![
    BondDesc {
        centroid: Vec3::new(0.0, 0.5, 0.0),
        normal: Vec3::new(0.0, 1.0, 0.0),
        area: 1.0,
        node0: 0,
        node1: 1,
    },
];
let settings = SolverSettings::default();
let mut solver = ExtStressSolver::new(&nodes, &bonds, &settings).unwrap();

solver.add_gravity(Vec3::new(0.0, -9.81, 0.0));
solver.update();

let overstressed = solver.overstressed_bond_count();

Re-exports§

pub use bond_stress::compute_bond_stress;
pub use ext_stress_solver::ExtStressSolver;
pub use stress_processor::StressBondDesc;
pub use stress_processor::StressDataParams;
pub use stress_processor::StressErrorSq;
pub use stress_processor::StressImpulse;
pub use stress_processor::StressNodeDesc;
pub use stress_processor::StressProcessor;
pub use stress_processor::StressSolverParams;
pub use stress_processor::StressVelocity;
pub use types::*;

Modules§

bond_stress
Pure-Rust bond stress computation (no FFI).
ext_stress_solver
High-level stress solver with NvBlast actor management and fracture support.
rapier
scenarios
stress_processor
Low-level safe wrapper around the C StressProcessor.
types