Start an `angle` module in `pathfinder_geometry`

This commit is contained in:
Patrick Walton 2020-02-19 10:58:53 -08:00
parent 95d5fab5ef
commit fd070d7a24
2 changed files with 20 additions and 0 deletions

19
geometry/src/angle.rs Normal file
View File

@ -0,0 +1,19 @@
// pathfinder/geometry/src/angle.rs
//
// Copyright © 2020 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Angle utilities.
use std::f32::consts::PI;
#[inline]
pub fn angle_from_degrees(degrees: f32) -> f32 {
const SCALE: f32 = 2.0 * PI / 360.0;
degrees * SCALE
}

View File

@ -10,6 +10,7 @@
//! Basic geometry and linear algebra primitives, optimized with SIMD. //! Basic geometry and linear algebra primitives, optimized with SIMD.
pub mod angle;
pub mod line_segment; pub mod line_segment;
pub mod rect; pub mod rect;
pub mod transform2d; pub mod transform2d;