use-collision 0.0.1

One-dimensional collision helpers for RustUse
Documentation
  • Coverage
  • 85%
    34 out of 40 items documented9 out of 34 items with examples
  • Size
  • Source code size: 29.66 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 595.19 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 6s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-physics
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-collision

One-dimensional collision, restitution, impulse, and kinetic-energy helpers for RustUse.

Install

[dependencies]
use-collision = "0.0.1"

Foundation

use-collision provides small, dependency-free helpers for scalar one-dimensional collision calculations.

Inputs are expected to be SI-style numeric values:

  • kilograms for mass
  • meters per second for velocity
  • kilogram meters per second for momentum
  • joules for kinetic energy
  • newton-seconds for impulse

The coefficient of restitution is modeled as a scalar in [0.0, 1.0].

Example

use use_collision::{Collision1D, CollisionBody1D};

let body_a = CollisionBody1D::new(1.0, 1.0).unwrap();
let body_b = CollisionBody1D::new(1.0, -1.0).unwrap();
let collision = Collision1D::new(body_a, body_b, 1.0).unwrap();

assert_eq!(collision.final_velocities(), Some((-1.0, 1.0)));
assert_eq!(collision.kinetic_energy_loss(), Some(0.0));

When to use directly

Choose use-collision when you need small, reusable helpers for one-dimensional collision outcomes, restitution, collision impulse, and kinetic-energy changes.

Scope

  • The crate focuses on scalar collision relations, coefficient of restitution, kinetic-energy changes, and impulse.
  • Momentum and broader impulse utilities belong in use-momentum.
  • Vector operations belong in use-vector.
  • Simulation loops belong in top-level use-simulation.
  • Rigid-body engines, contact solvers, vector mechanics, and game-physics systems are out of scope.

Status

use-collision is a pre-1.0 crate with a deliberately small API.