use-trigonometry
Install
[]
= "0.0.1"
Foundation
use-trigonometry provides a deliberately small trigonometry surface around explicit angle units. The crate exposes an Angle type stored in radians, conversion helpers for degrees and radians, normalization helpers for wrapped inputs, and direct sin, cos, and tan utilities for degree-based call sites. The first slice stays close to ordinary f64 values instead of introducing a larger symbolic or identity-heavy framework.
| Helper group | Primary items | Best fit |
|---|---|---|
| Angle values and unit conversion | Angle, degrees_to_radians, radians_to_degrees |
Code that should stay explicit about whether an input is degrees or radians |
| Normalization | Angle::normalized, Angle::normalized_signed, normalize_degrees, normalize_radians |
Handling wrapped or cyclic inputs before downstream math |
| Direct trig helpers | Angle::sin, Angle::cos, Angle::tan, sin_deg, cos_deg, tan_deg |
Small apps and utilities that want direct numeric trig without a larger abstraction |
When to use directly
Choose use-trigonometry directly when angle or trigonometric utilities are the only surface you need and you want to keep that concern narrower than the full facade.
| Scenario | Use use-trigonometry directly? |
Why |
|---|---|---|
| You need explicit degree/radian handling without a broader math facade | Yes | The crate keeps unit intent local and direct |
| You need wrapped-angle normalization and basic trig evaluation | Yes | The current surface already covers those cases with a small API |
| You also need geometry, calculus, or other math domains | Usually no | use-math can compose the concrete surfaces behind features |
Scope
- The current surface is intentionally small and concrete.
- Helpers stay numeric and explicit instead of introducing symbolic identities or generalized expression trees.
- Geometry-specific orientation and calculus-specific analytic helpers belong in adjacent focused crates.
Examples
Angle conversion and normalization
use ;
let acute = from_degrees;
let wrapped = from_degrees.normalized;
assert!;
assert!;
assert!;
assert!;
Direct trig helpers
use ;
let acute = from_degrees;
assert!;
assert!;
assert!;
assert!;
Status
use-trigonometry is a concrete pre-1.0 crate in the RustUse docs surface. The API remains intentionally small while adjacent geometry and calculus crates continue to grow around it.