Skip to content

Commit

Permalink
Preserve color when splitting face
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Jan 17, 2024
1 parent edab216 commit 2ad4085
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions crates/fj-core/src/operations/split/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
operations::{
build::{BuildFace, BuildHalfEdge},
insert::Insert,
presentation::SetColor,
split::SplitEdge,
update::{
UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion, UpdateShell,
Expand Down Expand Up @@ -131,14 +132,18 @@ impl SplitFace for Shell {
services,
)
.update_region(|region| {
region
.update_exterior(|cycle| {
cycle
.add_half_edges(half_edges_b_to_c_inclusive)
.add_half_edges([dividing_half_edge_c_to_b])
.insert(services)
})
.insert(services)
let mut region = region.update_exterior(|cycle| {
cycle
.add_half_edges(half_edges_b_to_c_inclusive)
.add_half_edges([dividing_half_edge_c_to_b])
.insert(services)
});

if let Some(color) = face.region().color() {
region = region.set_color(color);
}

region.insert(services)
})
.insert(services);

Expand All @@ -152,14 +157,18 @@ impl SplitFace for Shell {
services,
)
.update_region(|region| {
region
.update_exterior(|cycle| {
cycle
.add_half_edges(half_edges_d_to_a_inclusive)
.add_half_edges([dividing_half_edge_a_to_d])
.insert(services)
})
.insert(services)
let mut region = region.update_exterior(|cycle| {
cycle
.add_half_edges(half_edges_d_to_a_inclusive)
.add_half_edges([dividing_half_edge_a_to_d])
.insert(services)
});

if let Some(color) = face.region().color() {
region = region.set_color(color);
}

region.insert(services)
})
.insert(services);

Expand Down

0 comments on commit 2ad4085

Please sign in to comment.