Skip to main content

rscad_csg_bsp/
lib.rs

1//! Binary Space Partitioning for rscad
2//!
3//! references.
4//! https://developer.valvesoftware.com/wiki/Binary_space_partitioning
5
6pub mod affine;
7pub mod bsp;
8pub mod cleanup;
9pub mod csg;
10pub mod factory;
11pub mod metadata;
12pub mod plane;
13pub mod polygon;
14pub mod primitives;
15pub mod rotation;
16pub use affine::*;
17pub use bsp::*;
18pub use cleanup::*;
19pub use csg::*;
20pub use factory::*;
21pub use metadata::*;
22pub use plane::*;
23pub use polygon::*;
24pub use primitives::*;
25pub use rotation::*;
26
27#[cfg(feature = "bridge")]
28mod bridge;
29#[cfg(feature = "bridge")]
30pub use bridge::BspBackend;
31
32#[macro_export]
33macro_rules! WrapperTrait {
34    ($trait_name:ident, $($bounds:tt)+) => {
35        pub trait $trait_name: $($bounds)+ {}
36        impl<T> $trait_name for T where T: $($bounds)+ {}
37    };
38}
39
40WrapperTrait!(
41    Number,
42    num_traits::Float
43        + num_traits::FloatConst
44        + num_traits::One
45        + num_traits::Zero
46        + core::ops::AddAssign
47        + core::ops::SubAssign
48        + core::ops::MulAssign
49        + num_traits::real::Real
50        + nalgebra::RealField
51        + bytemuck::Pod
52        + Copy
53        + Clone
54        + PartialEq
55        + PartialOrd
56        + core::fmt::Debug
57        + Send
58        + Sync
59        + 'static
60);
61
62WrapperTrait!(
63    Index,
64    earcut::Index
65        + bytemuck::Pod
66        + Send
67        + Sync
68        + Copy
69        + Clone
70        + PartialEq
71        + PartialOrd
72        + core::fmt::Debug
73);