4 releases (breaking)

0.4.1 Feb 11, 2023
0.4.0 Feb 11, 2023
0.3.0 Feb 2, 2023
0.2.0 Sep 2, 2022
0.1.0 Aug 30, 2022

#227 in Math


1.5K SLoC


crates.io docs.rs

Unit agnostic angle.

What problem does it solve ?

Using simple floating point numbers to store an angle value is error-prone : you may add two angle with one in radians and the second in degrees or you may try to compute the cosine of a value in degrees and get an unexpected result.

angulus provides a type that represent an angle with no specific unit.


use angulus::prelude::*;

// Create an angle of 90°.
let alpha = 90.0_f32.deg();

// Create an angle of π/4 rad (45°).
let beta = Angle::RAD_FRAC_PI_4;

// Add the two angle without worrying about units.
let gamma = alpha + beta;

// Print the result.
    "The cosine of {} is {}",
    Degrees(gamma), // The angle is wrapped to display the value in degrees.
    gamma.cos()     // Compute the cosine without worrying about units.

// Output : The cosine of 135° is -0.70710677


  • serde: Serialization and deserialization with the serde crate.
  • rand: Generate random angle with the rand crate.

Minimum Supported Rust Version

This crate requires Rust 1.61.0 or later.


Licensed under either of the following, at your choice:

Unless explicitly stated otherwise, any contribution intentionally submitted for inclusion in this crate, as defined in the Apache-2.0 license, shall be dual-licensed as above, without any additional terms or conditions.