From 05aa620e85b694a7e16b2c746dcfdc41bed092dd Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 9 Sep 2022 15:30:49 +0200 Subject: [PATCH] Add `Solid::find_face` --- crates/fj-kernel/src/objects/solid.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/objects/solid.rs b/crates/fj-kernel/src/objects/solid.rs index 18558937b..e5b2f0e86 100644 --- a/crates/fj-kernel/src/objects/solid.rs +++ b/crates/fj-kernel/src/objects/solid.rs @@ -2,7 +2,7 @@ use std::collections::BTreeSet; use crate::builder::SolidBuilder; -use super::Shell; +use super::{Face, Shell}; /// A 3-dimensional shape /// @@ -49,6 +49,17 @@ impl Solid { pub fn into_shells(self) -> impl Iterator { self.shells.into_iter() } + + /// Find the given face in this solid + pub fn find_face(&self, face: &Face) -> Option { + for shell in self.shells() { + if let Some(face) = shell.find_face(face) { + return Some(face); + } + } + + None + } } impl Default for Solid {