use-gravity 0.0.1

Gravity, orbit, and gravitational energy helpers for RustUse
Documentation
  • Coverage
  • 80.95%
    17 out of 21 items documented5 out of 15 items with examples
  • Size
  • Source code size: 14.85 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 434.37 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s 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-gravity

Gravity-specific helpers for RustUse.

Install

[dependencies]
use-gravity = "0.0.1"

Foundation

use-gravity provides small f64-first helpers for gravitational force, gravitational acceleration, orbital velocity, escape velocity, orbital period, and gravitational potential energy.

Inputs are expected to be SI-style numeric values:

  • kilograms for mass
  • meters for distance, radius, and height
  • seconds for time
  • newtons for force
  • joules for energy

Example

use use_gravity::{GravityBody, escape_velocity, gravitational_force};

let earth = GravityBody::new(5.972e24, 6.371e6).unwrap();
let force = gravitational_force(1.0, 1.0, 1.0).unwrap();
let escape = escape_velocity(5.972e24, 6.371e6).unwrap();

assert_eq!(force, use_gravity::GRAVITATIONAL_CONSTANT);
assert!(earth.surface_gravity().unwrap() > 9.8);
assert!(escape > 11_000.0);

When to use directly

Choose use-gravity when you only need reusable gravity and orbit formulas.

Scope

  • APIs stay f64-first and do not define a full unit system.
  • The crate keeps only a couple of convenience constants locally.
  • Broader constants and units belong in the top-level use-constants and use-units sets.

Status

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