Skip to content

Commit

Permalink
Refactor to remove unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 24, 2023
1 parent 9da808e commit df1af1b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions crates/fj-core/src/operations/sweep/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,18 @@ impl SweepFace for Face {
let top_surface =
bottom_face.surface().clone().translate(path, services);

let mut top_exterior = None;
let top_exterior = sweep_cycle(
bottom_face.region().exterior(),
&bottom_face,
&mut faces,
path,
cache,
services,
);

let mut top_interiors = Vec::new();

for (i, bottom_cycle) in bottom_face.region().all_cycles().enumerate() {
for bottom_cycle in bottom_face.region().interiors() {
let top_cycle = sweep_cycle(
bottom_cycle,
&bottom_face,
Expand All @@ -69,15 +77,11 @@ impl SweepFace for Face {
services,
);

if i == 0 {
top_exterior = Some(top_cycle);
} else {
top_interiors.push(top_cycle);
};
top_interiors.push(top_cycle);
}

let top_region = Region::new(
top_exterior.unwrap(),
top_exterior,
top_interiors,
bottom_face.region().color(),
)
Expand Down

0 comments on commit df1af1b

Please sign in to comment.