use std::collections::BTreeSet;
use crate::{
objects::{Face, Shell},
storage::Handle,
};
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Solid {
shells: BTreeSet<Handle<Shell>>,
}
impl Solid {
pub fn new(shells: impl IntoIterator<Item = Handle<Shell>>) -> Self {
Self {
shells: shells.into_iter().collect(),
}
}
pub fn shells(&self) -> impl Iterator<Item = &Handle<Shell>> {
self.shells.iter()
}
pub fn find_face(&self, face: &Handle<Face>) -> Option<Handle<Face>> {
for shell in self.shells() {
if let Some(face) = shell.find_face(face) {
return Some(face);
}
}
None
}
}