From 2a055df18541dd109a041e0cfc783b0c2a265f72 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 22 Feb 2024 14:56:22 +0100 Subject: [PATCH 1/2] Remove redundant `set_color` calls The color does not need to be explicitly set here, as the `derive_from` is taking care of it. --- crates/fj-core/src/operations/split/face.rs | 27 +++------------------ 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/crates/fj-core/src/operations/split/face.rs b/crates/fj-core/src/operations/split/face.rs index c7fe6be55..efa99730a 100644 --- a/crates/fj-core/src/operations/split/face.rs +++ b/crates/fj-core/src/operations/split/face.rs @@ -8,7 +8,6 @@ use crate::{ build::{BuildCycle, BuildHalfEdge}, derive::DeriveFrom, insert::Insert, - presentation::SetColor, split::SplitEdge, update::{ UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion, UpdateShell, @@ -128,7 +127,7 @@ impl SplitFace for Shell { let split_face_a = updated_face_after_split_edges .update_region( |region, core| { - let mut region = region + region .update_exterior( |_, core| { Cycle::empty() @@ -144,16 +143,7 @@ impl SplitFace for Shell { core, ) .insert(core) - .derive_from(region, core); - - if let Some(color) = face.region().color() { - region = region - .set_color(color, core) - .insert(core) - .derive_from(®ion, core); - } - - region + .derive_from(region, core) }, core, ) @@ -168,7 +158,7 @@ impl SplitFace for Shell { let split_face_b = updated_face_after_split_edges .update_region( |region, core| { - let mut region = region + region .update_exterior( |_, core| { Cycle::empty() @@ -184,16 +174,7 @@ impl SplitFace for Shell { core, ) .insert(core) - .derive_from(region, core); - - if let Some(color) = face.region().color() { - region = region - .set_color(color, core) - .insert(core) - .derive_from(®ion, core); - } - - region + .derive_from(region, core) }, core, ) From 0c70cb5f415495f0fe1a78fd4fe928224ee5780a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 22 Feb 2024 14:58:05 +0100 Subject: [PATCH 2/2] Remove redundant calls to `insert`/`derive_from` Those are already called by `update_exterior`. --- crates/fj-core/src/operations/split/face.rs | 62 ++++++++++----------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/crates/fj-core/src/operations/split/face.rs b/crates/fj-core/src/operations/split/face.rs index efa99730a..e455b7de4 100644 --- a/crates/fj-core/src/operations/split/face.rs +++ b/crates/fj-core/src/operations/split/face.rs @@ -127,23 +127,20 @@ impl SplitFace for Shell { let split_face_a = updated_face_after_split_edges .update_region( |region, core| { - region - .update_exterior( - |_, core| { - Cycle::empty() - .add_half_edges( - half_edges_b_to_c_inclusive, - core, - ) - .add_half_edges( - [dividing_half_edge_c_to_b], - core, - ) - }, - core, - ) - .insert(core) - .derive_from(region, core) + region.update_exterior( + |_, core| { + Cycle::empty() + .add_half_edges( + half_edges_b_to_c_inclusive, + core, + ) + .add_half_edges( + [dividing_half_edge_c_to_b], + core, + ) + }, + core, + ) }, core, ) @@ -158,23 +155,20 @@ impl SplitFace for Shell { let split_face_b = updated_face_after_split_edges .update_region( |region, core| { - region - .update_exterior( - |_, core| { - Cycle::empty() - .add_half_edges( - half_edges_d_to_a_inclusive, - core, - ) - .add_half_edges( - [dividing_half_edge_a_to_d], - core, - ) - }, - core, - ) - .insert(core) - .derive_from(region, core) + region.update_exterior( + |_, core| { + Cycle::empty() + .add_half_edges( + half_edges_d_to_a_inclusive, + core, + ) + .add_half_edges( + [dividing_half_edge_a_to_d], + core, + ) + }, + core, + ) }, core, )