Crates.io | angular-units |
lib.rs | angular-units |
version | 0.2.4 |
source | src |
created_at | 2016-12-28 03:12:38.836966 |
updated_at | 2018-11-21 19:24:58.580758 |
description | A library for representing, manipulating and converting between angular quantities in various units through a type-safe interace. |
homepage | https://github.com/tylerreisinger/rust-angular-units |
repository | https://github.com/tylerreisinger/rust-angular-units |
max_upload_size | |
id | 7810 |
size | 36,516 |
Feature-rich library for representing and manipulating angular quantities. Provides strongly-typed structs for six units as well as helper traits for abstracting over the concrete types and doing common operations.
Deg<T>
Rad<T>
Gon<T>
Turns<T>
(1 turn is a full rotation)ArcMinutes<T>
ArcSeconds<T>
[dependencies]
angular-units = "0.2.4"
let angle = Deg(45.0);
let radians: Rad<_> = angle.into_angle();
let degrees: Deg<f32> = Deg(50.0_f32) + ArcMinutes(25.0_f32) + Rad(std::f32::consts::PI / 6.0_f32);
assert_eq!(Deg(240.0).interpolate(&Deg(180.0), 0.5), Deg(210.0))
Angular-units provides optional serde and approx support for all types by enabling their respective features.