fj_kernel/objects/full/
solid.rs1use std::collections::BTreeSet;
2
3use crate::{
4 objects::{Face, Shell},
5 storage::Handle,
6};
7
8#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
17pub struct Solid {
18 shells: BTreeSet<Handle<Shell>>,
19}
20
21impl Solid {
22 pub fn new(shells: impl IntoIterator<Item = Handle<Shell>>) -> Self {
24 Self {
25 shells: shells.into_iter().collect(),
26 }
27 }
28
29 pub fn shells(&self) -> impl Iterator<Item = &Handle<Shell>> {
31 self.shells.iter()
32 }
33
34 pub fn find_face(&self, face: &Handle<Face>) -> Option<Handle<Face>> {
36 for shell in self.shells() {
37 if let Some(face) = shell.find_face(face) {
38 return Some(face);
39 }
40 }
41
42 None
43 }
44}