mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-25 16:45:52 +00:00
Add convenient syntax for fj::Difference2d
This commit is contained in:
parent
d7bb3a5765
commit
222bb28771
@ -16,7 +16,8 @@ mod syntax;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::syntax::{
|
||||
Group as _, Rotate as _, Sketch as _, Sweep as _, Translate as _,
|
||||
Difference as _, Group as _, Rotate as _, Sketch as _, Sweep as _,
|
||||
Translate as _,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,24 @@
|
||||
pub trait Difference {
|
||||
fn difference<Other>(&self, other: &Other) -> crate::Difference2d
|
||||
where
|
||||
Other: Clone + Into<crate::Shape2d>;
|
||||
}
|
||||
|
||||
impl<T> Difference for T
|
||||
where
|
||||
T: Clone + Into<crate::Shape2d>,
|
||||
{
|
||||
fn difference<Other>(&self, other: &Other) -> crate::Difference2d
|
||||
where
|
||||
Other: Clone + Into<crate::Shape2d>,
|
||||
{
|
||||
let a = self.clone().into();
|
||||
let b = other.clone().into();
|
||||
|
||||
crate::Difference2d::from_objects(a, b)
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Group {
|
||||
fn group<Other>(&self, other: &Other) -> crate::Group
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user