Expand description
§use-work
Mechanical work helpers for RustUse.
§Install
[dependencies]
use-work = "0.0.1"§Foundation
use-work provides small f64-first helpers for mechanical work, work at an angle, net work, spring work, gravitational work, friction work, and simple work-energy relationships.
Inputs are expected to be SI-style numeric values:
- newtons for force and friction force magnitude
- meters for displacement, height, and spring displacement
- joules for work and energy
- radians for angle helpers unless the function name says degrees
- newtons per meter for spring constant
The crate does not define a full unit system.
§Example
use use_work::{ConstantForceWork, work, work_at_angle_degrees};
let constant = ConstantForceWork::new(10.0, 2.0).unwrap();
assert_eq!(work(10.0, 2.0), Some(20.0));
assert_eq!(constant.work(), Some(20.0));
assert!((work_at_angle_degrees(10.0, 2.0, 60.0).unwrap() - 10.0).abs() < 1e-12);§When to use directly
Choose use-work when you only need reusable scalar helpers for mechanical work calculations.
§Scope
- APIs stay
f64-first and do not define a full unit system. - Vector operations should live in or compose with
use-vector. - Broad energy helpers belong in
use-energy. - Broad power helpers belong in
use-power.
§Status
use-work is a pre-1.0 crate with a deliberately small API.
Mechanical work helpers.
Modules§
Structs§
- Constant
Force Work - Constant-force work inputs for repeated calculations.
Functions§
- displacement_
from_ work - Computes the displacement implied by a work value and a constant force.
- final_
kinetic_ energy_ from_ work - Computes final kinetic energy from an initial kinetic energy and applied work.
- force_
from_ work - Computes the force required to perform a given amount of work over a displacement.
- initial_
kinetic_ energy_ from_ work - Computes initial kinetic energy from a final kinetic energy and applied work.
- net_
work - Computes the net work from a slice of work contributions.
- spring_
potential_ energy - Computes the spring potential energy stored at a displacement.
- spring_
work - Computes work done by an ideal spring force over a displacement interval.
- work
- Computes mechanical work from a constant force and displacement.
- work_
against_ gravity - Computes work done against gravity near a surface.
- work_
at_ angle - Computes mechanical work when the force is applied at an angle to the displacement.
- work_
at_ angle_ degrees - Computes mechanical work when the applied-force angle is given in degrees.
- work_
by_ friction - Computes work done by kinetic friction.
- work_
by_ gravity - Computes work done by gravity near a surface.
- work_
from_ force_ samples - Approximates work from aligned force and displacement samples.
- work_
from_ kinetic_ energy_ change - Computes net work from the change in kinetic energy.