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
30macro_rules! show {
31  ($e:expr) => { println!("{}: {:?}", stringify!($e), $e); }
32}
33
34/// Print the sizes of some types
35pub fn report_sizes() {
36  use std::mem::size_of;
37  println!("report sizes...");
38  show!(size_of::<Vector4 <f32>>());
39  show!(size_of::<Matrix2 <f32>>());
40  show!(size_of::<Matrix3 <f32>>());
41  show!(size_of::<Rotation2 <f32>>());
42  show!(size_of::<Rotation3 <f32>>());
43  println!("...report sizes");
44}