From 262b0f233f464de70d781d6bd0d49ed5eaa61d02 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Oct 2022 13:29:43 +0200 Subject: [PATCH] Remove unused argument from `Shape::compute_brep` --- crates/fj-operations/src/difference_2d.rs | 8 ++------ crates/fj-operations/src/group.rs | 7 ++----- crates/fj-operations/src/lib.rs | 15 ++++++--------- crates/fj-operations/src/shape_processor.rs | 6 ++---- crates/fj-operations/src/sketch.rs | 3 --- crates/fj-operations/src/sweep.rs | 7 +------ crates/fj-operations/src/transform.rs | 5 +---- 7 files changed, 14 insertions(+), 37 deletions(-) diff --git a/crates/fj-operations/src/difference_2d.rs b/crates/fj-operations/src/difference_2d.rs index 3c1552580..055c7feec 100644 --- a/crates/fj-operations/src/difference_2d.rs +++ b/crates/fj-operations/src/difference_2d.rs @@ -9,8 +9,6 @@ use fj_kernel::{ }; use fj_math::Aabb; -use crate::planes::Planes; - use super::Shape; impl Shape for fj::Difference2d { @@ -20,7 +18,6 @@ impl Shape for fj::Difference2d { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { // This method assumes that `b` is fully contained within `a`: @@ -35,9 +32,8 @@ impl Shape for fj::Difference2d { // - https://doc.rust-lang.org/std/primitive.array.html#method.each_ref // - https://doc.rust-lang.org/std/primitive.array.html#method.try_map let [a, b] = self.shapes(); - let [a, b] = [a, b].map(|shape| { - shape.compute_brep(config, objects, planes, debug_info) - }); + let [a, b] = + [a, b].map(|shape| shape.compute_brep(config, objects, debug_info)); let [a, b] = [a?, b?]; if let Some(face) = a.face_iter().next() { diff --git a/crates/fj-operations/src/group.rs b/crates/fj-operations/src/group.rs index 03856d8f9..def6708e6 100644 --- a/crates/fj-operations/src/group.rs +++ b/crates/fj-operations/src/group.rs @@ -7,8 +7,6 @@ use fj_kernel::{ }; use fj_math::Aabb; -use crate::planes::Planes; - use super::Shape; impl Shape for fj::Group { @@ -18,13 +16,12 @@ impl Shape for fj::Group { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { let mut faces = Faces::new(); - let a = self.a.compute_brep(config, objects, planes, debug_info)?; - let b = self.b.compute_brep(config, objects, planes, debug_info)?; + let a = self.a.compute_brep(config, objects, debug_info)?; + let b = self.b.compute_brep(config, objects, debug_info)?; faces.extend(a.into_inner()); faces.extend(b.into_inner()); diff --git a/crates/fj-operations/src/lib.rs b/crates/fj-operations/src/lib.rs index d0eaf4fad..4120169b8 100644 --- a/crates/fj-operations/src/lib.rs +++ b/crates/fj-operations/src/lib.rs @@ -46,7 +46,6 @@ pub trait Shape { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError>; @@ -64,20 +63,19 @@ impl Shape for fj::Shape { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { match self { Self::Shape2d(shape) => shape - .compute_brep(config, objects, planes, debug_info)? + .compute_brep(config, objects, debug_info)? .into_inner() .into_faces() .validate_with_config(config), Self::Group(shape) => { - shape.compute_brep(config, objects, planes, debug_info) + shape.compute_brep(config, objects, debug_info) } Self::Sweep(shape) => shape - .compute_brep(config, objects, planes, debug_info)? + .compute_brep(config, objects, debug_info)? .into_inner() .into_shells() .map(|shell| shell.into_faces()) @@ -88,7 +86,7 @@ impl Shape for fj::Shape { .unwrap_or_default() .validate_with_config(config), Self::Transform(shape) => { - shape.compute_brep(config, objects, planes, debug_info) + shape.compute_brep(config, objects, debug_info) } } } @@ -110,15 +108,14 @@ impl Shape for fj::Shape2d { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { match self { Self::Difference(shape) => { - shape.compute_brep(config, objects, planes, debug_info) + shape.compute_brep(config, objects, debug_info) } Self::Sketch(shape) => { - shape.compute_brep(config, objects, planes, debug_info) + shape.compute_brep(config, objects, debug_info) } } } diff --git a/crates/fj-operations/src/shape_processor.rs b/crates/fj-operations/src/shape_processor.rs index 0bc741e19..43d6757ee 100644 --- a/crates/fj-operations/src/shape_processor.rs +++ b/crates/fj-operations/src/shape_processor.rs @@ -11,7 +11,7 @@ use fj_kernel::{ }; use fj_math::Scalar; -use crate::{planes::Planes, Shape as _}; +use crate::Shape as _; /// Processes an [`fj::Shape`] into a [`ProcessedShape`] pub struct ShapeProcessor { @@ -44,10 +44,8 @@ impl ShapeProcessor { let config = ValidationConfig::default(); let objects = Objects::new(); - let planes = Planes::new(&objects); let mut debug_info = DebugInfo::new(); - let shape = - shape.compute_brep(&config, &objects, &planes, &mut debug_info)?; + let shape = shape.compute_brep(&config, &objects, &mut debug_info)?; let mesh = (&shape.into_inner(), tolerance).triangulate(); Ok(ProcessedShape { diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 5195239c5..814f00952 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -8,8 +8,6 @@ use fj_kernel::{ }; use fj_math::{Aabb, Point}; -use crate::planes::Planes; - use super::Shape; impl Shape for fj::Sketch { @@ -19,7 +17,6 @@ impl Shape for fj::Sketch { &self, config: &ValidationConfig, objects: &Objects, - _: &Planes, _: &mut DebugInfo, ) -> Result, ValidationError> { let surface = objects.surfaces.xy_plane(); diff --git a/crates/fj-operations/src/sweep.rs b/crates/fj-operations/src/sweep.rs index 036c43465..475978233 100644 --- a/crates/fj-operations/src/sweep.rs +++ b/crates/fj-operations/src/sweep.rs @@ -8,8 +8,6 @@ use fj_kernel::{ }; use fj_math::{Aabb, Vector}; -use crate::planes::Planes; - use super::Shape; impl Shape for fj::Sweep { @@ -19,12 +17,9 @@ impl Shape for fj::Sweep { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { - let sketch = self - .shape() - .compute_brep(config, objects, planes, debug_info)?; + let sketch = self.shape().compute_brep(config, objects, debug_info)?; let path = Vector::from(self.path()); let solid = sketch.into_inner().sweep(path, objects); diff --git a/crates/fj-operations/src/transform.rs b/crates/fj-operations/src/transform.rs index 52d0f7858..981302f9c 100644 --- a/crates/fj-operations/src/transform.rs +++ b/crates/fj-operations/src/transform.rs @@ -8,8 +8,6 @@ use fj_kernel::{ }; use fj_math::{Aabb, Transform, Vector}; -use crate::planes::Planes; - use super::Shape; impl Shape for fj::Transform { @@ -19,12 +17,11 @@ impl Shape for fj::Transform { &self, config: &ValidationConfig, objects: &Objects, - planes: &Planes, debug_info: &mut DebugInfo, ) -> Result, ValidationError> { let faces = self .shape - .compute_brep(config, objects, planes, debug_info)? + .compute_brep(config, objects, debug_info)? .into_inner() .transform(&make_transform(self), objects);