Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify SplitFace::split_face #2233

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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