From ba3c26eba25624331ee7c660b24b17b2963d73a4 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Jun 2023 13:10:07 +0200 Subject: [PATCH] Add `Merge` operation --- crates/fj-core/src/operations/merge.rs | 15 +++++++++++++++ crates/fj-core/src/operations/mod.rs | 2 ++ 2 files changed, 17 insertions(+) create mode 100644 crates/fj-core/src/operations/merge.rs diff --git a/crates/fj-core/src/operations/merge.rs b/crates/fj-core/src/operations/merge.rs new file mode 100644 index 000000000..968a6b3c5 --- /dev/null +++ b/crates/fj-core/src/operations/merge.rs @@ -0,0 +1,15 @@ +use crate::objects::Solid; + +use super::UpdateSolid; + +/// Merge two [`Solid`]s +pub trait Merge { + /// Merge this solid with another + fn merge(&self, other: &Self) -> Self; +} + +impl Merge for Solid { + fn merge(&self, other: &Self) -> Self { + self.add_shells(other.shells().cloned()) + } +} diff --git a/crates/fj-core/src/operations/mod.rs b/crates/fj-core/src/operations/mod.rs index 5d43064e4..3cd87865a 100644 --- a/crates/fj-core/src/operations/mod.rs +++ b/crates/fj-core/src/operations/mod.rs @@ -3,6 +3,7 @@ mod build; mod insert; mod join; +mod merge; mod reverse; mod update; @@ -19,6 +20,7 @@ pub use self::{ }, insert::{Insert, IsInserted, IsInsertedNo, IsInsertedYes}, join::cycle::JoinCycle, + merge::Merge, reverse::Reverse, update::{ cycle::UpdateCycle, edge::UpdateHalfEdge, face::UpdateFace,