Skip to main content

Crate use_work

Crate use_work 

Source
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§

prelude

Structs§

ConstantForceWork
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.