2018-02-23 12:04:26 +01:00
|
|
|
//! Module containing all the math structs and functions.
|
|
|
|
|
|
|
|
pub mod vector;
|
|
|
|
pub mod bounding_box;
|
2018-06-12 17:22:16 +02:00
|
|
|
pub mod plane;
|
|
|
|
pub mod frustum;
|
2018-02-23 12:04:26 +01:00
|
|
|
|
|
|
|
use std::ops::{Add, AddAssign, Sub, SubAssign, Mul, MulAssign, Div, DivAssign};
|
|
|
|
use num::{Zero, One};
|
|
|
|
|
|
|
|
/// A number.
|
|
|
|
///
|
|
|
|
/// This trait is used to implement the operator traits on the vector struct.
|
|
|
|
pub trait Number: Copy + Clone + PartialOrd + Zero + One
|
|
|
|
+ Add<Output = Self> + AddAssign
|
|
|
|
+ Sub<Output = Self> + SubAssign
|
|
|
|
+ Mul<Output = Self> + MulAssign
|
|
|
|
+ Div<Output = Self> + DivAssign
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Number for i16 {}
|
|
|
|
impl Number for i32 {}
|
|
|
|
impl Number for i64 {}
|
|
|
|
impl Number for isize {}
|
|
|
|
|
|
|
|
impl Number for u16 {}
|
|
|
|
impl Number for u32 {}
|
|
|
|
impl Number for u64 {}
|
|
|
|
impl Number for usize {}
|
|
|
|
|
|
|
|
impl Number for f32 {}
|
|
|
|
impl Number for f64 {}
|
|
|
|
|