Crate askew

Crate askew 

Source
Expand description

Angles (degrees, radians, and turns).

§Why

This crate provides a type-safe abstraction for working with angles in different units (radians, degrees, turns, and percentage of a full circle). It helps prevent mistakes when converting between units and provides a convenient API for common angle operations.

Angle is currently represented as f32-based radians, but may be extended in the future.

§Examples

use askew::Angle;

let angle = Angle::from_degrees(90.0);
assert_eq!(angle.as_radians(), std::f32::consts::PI / 2.0);
assert_eq!(angle.as_degrees(), 90.0);
assert_eq!(angle.as_turns(), 0.25);
assert_eq!(angle.as_percentage(), 0.25);

§Features

This crate is #![no_std] compatible, but by default uses std for floating-point operations.

§approx

Enables the approx crate for implementing traits like RelativeEq.

§bytemuck

Enables the bytemuck crate for zero-copy conversions.

§libm

Enables the libm crate for floating-point operations.

§serde

Enables the serde crate for serialization and deserialization.

§std

Enables the standard library for floating-point operations.

If you want to use the libm crate instead, disable this feature:

[dependencies.askew]
default-features = false
features = ["libm"]

Structs§

Angle
Radian representation of an angle.