Skip to main content

Crate use_statics

Crate use_statics 

Source
Expand description

§use-statics

Small statics helpers for RustUse.

§Install

[dependencies]
use-statics = "0.0.1"

§Foundation

use-statics provides small helpers for force balance, moment balance, equilibrium checks, static friction, inclined planes, and simple support reactions.

Inputs are expected to be SI-style numeric values:

  • newtons for force and load
  • meters for span, position, and moment arm
  • newton-meters for moment
  • kilograms for mass
  • radians for incline angle
  • newtons per meter for distributed load

The crate stays narrow on purpose. It is not a structural analysis engine, finite element solver, truss solver, frame solver, rigid-body physics engine, or simulation framework.

Vector operations should live in or compose with use-vector. Torque-specific helpers belong in use-torque. Rigid-body mechanics belong in use-rigidbody. Simulation belongs in top-level use-simulation.

§Example

use use_statics::{
    CantileverReaction, Force2D, StaticSystem2D, cantilever_end_point_load_reaction,
    simply_supported_point_load_reactions,
};

let Some(system) = StaticSystem2D::new(
    vec![
        Force2D::new(100.0, 0.0).unwrap(),
        Force2D::new(-100.0, 0.0).unwrap(),
    ],
    vec![0.0],
) else {
    panic!("valid system should construct");
};

let Some((left, right)) = simply_supported_point_load_reactions(10.0, 100.0, 5.0) else {
    panic!("valid point load should produce reactions");
};

let Some(cantilever) = cantilever_end_point_load_reaction(2.0, 50.0) else {
    panic!("valid cantilever load should produce a reaction");
};

assert_eq!(system.is_equilibrium(0.0), Some(true));
assert_eq!((left, right), (50.0, 50.0));
assert_eq!(
    cantilever,
    CantileverReaction {
        vertical_reaction: 50.0,
        fixed_end_moment: 100.0,
    }
);

§When to use directly

Choose use-statics when you want small, direct helpers for introductory or utility-level statics work without pulling in a broader mechanics surface.

§Scope

  • APIs stay dependency-free and f64-first.
  • Helpers focus on scalar formulas and simple 2D force and moment balances.
  • Arbitrary beam loading, truss analysis, frame analysis, FEA, CAD, and design-code compliance are out of scope.
  • Broad vector algebra belongs in use-vector or companion math crates.

§Status

use-statics is a pre-1.0 crate with a deliberately small API. Small statics helpers.

Modules§

prelude
Re-exports for ergonomic glob imports.

Structs§

CantileverReaction
Fixed-end reaction data for a cantilever with a free-end point load.
Force2D
A validated planar force value.
PointForce2D
A planar force applied at a position relative to a chosen moment point.
StaticSystem2D
A simple planar static system made of force vectors and scalar moments.

Functions§

can_static_friction_hold
Checks whether static friction can hold a body at rest.
cantilever_end_point_load_reaction
Computes the fixed-end reaction for a cantilever with a downward load at the free end.
downslope_force_incline
Computes the downslope component of weight on an incline.
force_angle_radians
Computes the planar angle of a force vector in radians.
force_magnitude
Computes the magnitude of a planar force vector.
is_rotational_equilibrium
Checks whether a moment system is in rotational equilibrium.
is_static_equilibrium_2d
Checks whether a planar static system satisfies both translational and rotational equilibrium.
is_translational_equilibrium_1d
Checks whether a 1D force system is in translational equilibrium.
is_translational_equilibrium_2d
Checks whether a 2D force system is in translational equilibrium.
maximum_static_friction
Computes the maximum available static friction.
minimum_static_friction_coefficient_for_incline
Computes the minimum static friction coefficient needed to prevent sliding on an incline.
moment_2d
Computes the scalar z-moment of a planar force about a chosen point.
moment_from_force_and_arm
Computes a moment from a signed force and a signed moment arm.
net_force_1d
Computes the net force from a list of scalar forces.
net_force_2d
Computes the net force from a list of planar force components.
net_moment
Computes the net moment from a slice of scalar moment values.
net_moment_2d
Computes the net moment from planar point forces.
normal_force_horizontal_surface
Computes the normal force on a horizontal surface.
normal_force_incline
Computes the normal force on an incline.
required_static_friction
Computes the static friction magnitude required to hold horizontal equilibrium.
simply_supported_point_load_reactions
Computes support reactions for a simply supported beam with one point load.
simply_supported_uniform_load_reactions
Computes support reactions for a simply supported beam with a uniform load.