1mod aabb;
2mod interpolation;
3mod num;
4mod orthographic;
5mod perspective;
6
7use cgmath::Vector2;
8
9pub use self::aabb::AABB2D;
10pub use self::interpolation::Interpolation;
11pub use self::num::{Float, UnsignedInteger};
12pub use self::orthographic::{ortho_from_bounds, OrthographicCamera};
13pub use self::perspective::PerspectiveCamera;
14
15pub const TAO: f32 = 6.283_185_307_179_586_476f32;
17pub const PI: f32 = 3.141_592_653_589_793_238f32;
19pub const PI_2: f32 = 1.570_796_326_794_896_619f32;
21pub const PI_NEG_2: f32 = -1.570_796_326_794_896_619f32;
23pub const IDENTITY_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
25 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, );
30
31pub fn fast_normalize2(vector: Vector2<f32>) -> Vector2<f32> {
33 vector * (vector.x * vector.x + vector.y * vector.y).inv_sqrt()
34}
35
36pub fn lerp(a: f32, b: f32, t: f32) -> f32 {
38 a + t * (b - a)
39}