fj_core/objects/kinds/solid.rs
1use crate::{
2 objects::{ObjectSet, Shell},
3 storage::Handle,
4};
5
6/// A 3-dimensional shape, built from [`Shell`]s. Many Solids will contains only
7/// one shell, but if the Solid contains cavities they will be represented by a
8/// shell each, as well as a shell for the outside.
9///
10/// # Implementation Note
11///
12/// The shells that form the boundaries of the solid must not intersect. This is
13/// not currently validated.
14#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
15pub struct Solid {
16 shells: ObjectSet<Shell>,
17}
18
19impl Solid {
20 /// Construct an empty instance of `Solid`
21 pub fn new(shells: impl IntoIterator<Item = Handle<Shell>>) -> Self {
22 Self {
23 shells: shells.into_iter().collect(),
24 }
25 }
26
27 /// Access the solid's shells
28 pub fn shells(&self) -> &ObjectSet<Shell> {
29 &self.shells
30 }
31}