Merge pull request #1830 from hannobraun/cleanup

Make some cleanups
This commit is contained in:
Hanno Braun 2023-05-22 13:10:03 +02:00 committed by GitHub
commit b28cf86d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 35 deletions

View File

@ -28,12 +28,12 @@ impl Region {
/// Construct an instance of `Region`
pub fn new(
exterior: Handle<Cycle>,
interiors: Vec<Handle<Cycle>>,
interiors: impl IntoIterator<Item = Handle<Cycle>>,
color: Option<Color>,
) -> Self {
Self {
exterior,
interiors,
interiors: interiors.into_iter().collect(),
color,
}
}

View File

@ -47,8 +47,6 @@ impl Face {
interiors: impl IntoIterator<Item = Handle<Cycle>>,
color: Option<Color>,
) -> Self {
let interiors = interiors.into_iter().collect();
Self {
surface,
region: Region::new(exterior, interiors, color),
@ -111,17 +109,6 @@ impl FaceSet {
pub fn new() -> Self {
Self::default()
}
/// Find the given face
pub fn find(&self, face: &Handle<Face>) -> Option<Handle<Face>> {
for f in self {
if f == face {
return Some(f.clone());
}
}
None
}
}
impl Extend<Handle<Face>> for FaceSet {

View File

@ -26,9 +26,4 @@ impl Shell {
pub fn faces(&self) -> &FaceSet {
&self.faces
}
/// Find the given face in the shell
pub fn find_face(&self, face: &Handle<Face>) -> Option<Handle<Face>> {
self.faces().find(face)
}
}

View File

@ -1,9 +1,6 @@
use std::collections::BTreeSet;
use crate::{
objects::{Face, Shell},
storage::Handle,
};
use crate::{objects::Shell, storage::Handle};
/// A 3-dimensional shape, built from [`Shell`]s. Many Solids will contains only
/// one shell, but if the Solid contains cavities they will be represented by a
@ -30,15 +27,4 @@ impl Solid {
pub fn shells(&self) -> impl Iterator<Item = &Handle<Shell>> {
self.shells.iter()
}
/// Find the given face in the solid
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
}
}