1mod boolean_op;
7
8pub mod bounds;
9pub mod color;
10pub mod core_error;
11pub mod geo2d;
12pub mod geo3d;
13pub mod length;
14pub mod render;
15pub mod traits;
16pub mod triangle;
17
18pub type Integer = i64;
20pub type Scalar = f64;
22pub type Vec2 = cgmath::Vector2<Scalar>;
24pub type Vec3 = cgmath::Vector3<Scalar>;
26pub type Vec4 = cgmath::Vector4<Scalar>;
28pub type Mat2 = cgmath::Matrix2<Scalar>;
30pub type Mat3 = cgmath::Matrix3<Scalar>;
32pub type Mat4 = cgmath::Matrix4<Scalar>;
34pub type Angle = cgmath::Rad<Scalar>;
36pub use length::Length;
38
39pub mod consts {
41 pub use std::f64::consts::PI;
42 pub use std::f64::consts::TAU;
43}
44
45pub use boolean_op::BooleanOp;
46pub use bounds::*;
47pub use color::*;
48pub use core_error::*;
49pub use geo2d::*;
50pub use geo3d::*;
51pub use render::*;
52pub use triangle::*;
53
54pub fn mat4_to_mat3(m: &Mat4) -> Mat3 {
56 Mat3::from_cols(m.x.truncate_n(2), m.y.truncate_n(2), m.w.truncate_n(2))
57}
58
59pub fn mat3_to_mat4(m: &Mat3) -> Mat4 {
61 Mat4::new(
62 m.x.x, m.x.y, 0.0, m.x.z, m.y.x, m.y.y, 0.0, m.y.z, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, )
67}