Add `UpdateSolid`

This commit is contained in:
Hanno Braun 2023-03-24 14:15:33 +01:00
parent 63bc10415e
commit 01ba108aa2
3 changed files with 22 additions and 2 deletions

View File

@ -12,5 +12,7 @@ pub use self::{
}, },
insert::{Insert, IsInserted, IsInsertedNo, IsInsertedYes}, insert::{Insert, IsInserted, IsInsertedNo, IsInsertedYes},
join::JoinCycle, join::JoinCycle,
update::{UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateShell}, update::{
UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateShell, UpdateSolid,
},
}; };

View File

@ -2,8 +2,9 @@ mod cycle;
mod edge; mod edge;
mod face; mod face;
mod shell; mod shell;
mod solid;
pub use self::{ pub use self::{
cycle::UpdateCycle, edge::UpdateHalfEdge, face::UpdateFace, cycle::UpdateCycle, edge::UpdateHalfEdge, face::UpdateFace,
shell::UpdateShell, shell::UpdateShell, solid::UpdateSolid,
}; };

View File

@ -0,0 +1,17 @@
use crate::{
objects::{Shell, Solid},
storage::Handle,
};
/// Update a [`Solid`]
pub trait UpdateSolid {
/// Add a shell to the solid
fn add_shell(&self, shell: Handle<Shell>) -> Solid;
}
impl UpdateSolid for Solid {
fn add_shell(&self, shell: Handle<Shell>) -> Solid {
let shells = self.shells().cloned().chain([shell]);
Solid::new(shells)
}
}