| 1 | // pathfinder/geometry/src/angle.rs |
| 2 | // |
| 3 | // Copyright © 2020 The Pathfinder Project Developers. |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | // option. This file may not be copied, modified, or distributed |
| 9 | // except according to those terms. |
| 10 | |
| 11 | //! Angle utilities. |
| 12 | |
| 13 | use std::f32::consts::PI; |
| 14 | |
| 15 | #[inline ] |
| 16 | pub fn angle_from_degrees(degrees: f32) -> f32 { |
| 17 | const SCALE: f32 = 2.0 * PI / 360.0; |
| 18 | degrees * SCALE |
| 19 | } |
| 20 | |