Skip to content

Commit

Permalink
Merge pull request #2233 from hannobraun/presentation
Browse files Browse the repository at this point in the history
Simplify `SplitFace::split_face`
  • Loading branch information
hannobraun authored Feb 22, 2024
2 parents d18e607 + 0c70cb5 commit 00faa85
Showing 1 changed file with 28 additions and 53 deletions.
81 changes: 28 additions & 53 deletions crates/fj-core/src/operations/split/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
build::{BuildCycle, BuildHalfEdge},
derive::DeriveFrom,
insert::Insert,
presentation::SetColor,
split::SplitEdge,
update::{
UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion, UpdateShell,
Expand Down Expand Up @@ -128,32 +127,20 @@ impl SplitFace for Shell {
let split_face_a = updated_face_after_split_edges
.update_region(
|region, core| {
let mut region = 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);

if let Some(color) = face.region().color() {
region = region
.set_color(color, core)
.insert(core)
.derive_from(&region, core);
}

region
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,
)
Expand All @@ -168,32 +155,20 @@ impl SplitFace for Shell {
let split_face_b = updated_face_after_split_edges
.update_region(
|region, core| {
let mut region = 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);

if let Some(color) = face.region().color() {
region = region
.set_color(color, core)
.insert(core)
.derive_from(&region, core);
}

region
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,
)
Expand Down

0 comments on commit 00faa85

Please sign in to comment.