math_utils/
lib.rs

1//! Math types and traits
2
3#![feature(decl_macro)]
4
5pub use vek::approx;
6pub use vek::num_traits;
7pub use vek as vek;
8
9pub mod geometry;
10
11mod fixed;
12mod traits;
13mod types;
14
15pub use self::fixed::*;
16pub use self::traits::*;
17pub use self::types::*;
18
19/// 0
20pub const COMPONENT_INDEX_X : usize = 0;
21/// 1
22pub const COMPONENT_INDEX_Y : usize = 1;
23/// 2
24pub const COMPONENT_INDEX_Z : usize = 2;
25/// 3
26pub const COMPONENT_INDEX_W : usize = 3;
27
28
29/// Convenience macro
30#[doc(hidden)]
31#[macro_export]
32macro_rules! show {
33  ($e:expr) => { println!("{}: {:?}", stringify!($e), $e); }
34}
35
36/// Print the sizes of some types
37pub fn report_sizes() {
38  use std::mem::size_of;
39  println!("report sizes...");
40  show!(size_of::<Vector4 <f32>>());
41  show!(size_of::<Matrix2 <f32>>());
42  show!(size_of::<Matrix3 <f32>>());
43  show!(size_of::<Rotation2 <f32>>());
44  show!(size_of::<Rotation3 <f32>>());
45  println!("...report sizes");
46}