1mod boolean_op;
7
8pub mod bounds;
9pub mod color;
10pub mod core_error;
11pub mod geo2d;
12#[cfg(feature = "geo3d")]
13pub mod geo3d;
14pub mod length;
15pub mod render;
16pub mod traits;
17pub mod triangle;
18
19pub type Integer = i64;
21pub type Scalar = f64;
23pub type Vec2 = cgmath::Vector2<Scalar>;
25pub type Vec3 = cgmath::Vector3<Scalar>;
27pub type Vec4 = cgmath::Vector4<Scalar>;
29pub type Mat2 = cgmath::Matrix2<Scalar>;
31pub type Mat3 = cgmath::Matrix3<Scalar>;
33pub type Mat4 = cgmath::Matrix4<Scalar>;
35pub type Angle = cgmath::Rad<Scalar>;
37pub use length::Length;
39
40pub mod consts {
42 pub use std::f64::consts::PI;
43 pub use std::f64::consts::TAU;
44}
45
46pub use boolean_op::BooleanOp;
47pub use bounds::*;
48pub use color::*;
49pub use core_error::*;
50pub use geo2d::*;
51pub use geo3d::*;
52pub use render::*;
53pub use triangle::*;
54
55pub fn mat4_to_mat3(m: &Mat4) -> Mat3 {
57 Mat3::from_cols(m.x.truncate_n(2), m.y.truncate_n(2), m.w.truncate_n(2))
58}
59
60pub fn mat3_to_mat4(m: &Mat3) -> Mat4 {
62 Mat4::new(
63 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, )
68}