forky_core/math/
constants.rs1use num_traits::AsPrimitive;
4use num_traits::Num;
5
6pub const TAU: f32 = std::f32::consts::TAU;
7pub const QUARTER_TAU: f32 = TAU * 0.25;
8pub const HALF_TAU: f32 = TAU * 0.5;
9pub const THREE_QUARTER_TAU: f32 = TAU * 0.75;
10
11pub const PI: f32 = HALF_TAU;
12
13pub const GRAVITY: f32 = -9.81;
14
15
16pub const DEG2RAD: f32 = PI / 180.;
17pub const RAD2DEG: f32 = 180. / PI;
18pub const RAD2HOURS: f32 = 12. / PI;
19pub const HOURS2RAD: f32 = PI / 12.;
20pub const DEG2HOURS: f32 = 1. / 15.;
21pub const HOURS2DEG: f32 = 15.;
22
23pub fn f<T>(val: T) -> f32
25where
26 T: Num + AsPrimitive<f32>,
27{
28 val.as_()
29}
30