Start an `angle` module in `pathfinder_geometry`
This commit is contained in:
parent
95d5fab5ef
commit
fd070d7a24
|
@ -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
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue