Skip to content

Commit

Permalink
Add Solid::find_face
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Sep 9, 2022
1 parent 2453730 commit 05aa620
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/fj-kernel/src/objects/solid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::BTreeSet;

use crate::builder::SolidBuilder;

use super::Shell;
use super::{Face, Shell};

/// A 3-dimensional shape
///
Expand Down Expand Up @@ -49,6 +49,17 @@ impl Solid {
pub fn into_shells(self) -> impl Iterator<Item = Shell> {
self.shells.into_iter()
}

/// Find the given face in this solid
pub fn find_face(&self, face: &Face) -> Option<Face> {
for shell in self.shells() {
if let Some(face) = shell.find_face(face) {
return Some(face);
}
}

None
}
}

impl Default for Solid {
Expand Down

0 comments on commit 05aa620

Please sign in to comment.