Skip to content

Commit

Permalink
Return more information from SplitFace method
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Nov 28, 2023
1 parent 596340a commit 21fbc2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions crates/fj-core/src/operations/split/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub trait SplitFace: Sized {
face: &Handle<Face>,
line: [(&Handle<HalfEdge>, impl Into<Point<1>>); 2],
services: &mut Services,
) -> Self;
) -> (Self, [Handle<Face>; 2]);
}

impl SplitFace for Shell {
Expand All @@ -49,7 +49,7 @@ impl SplitFace for Shell {
face: &Handle<Face>,
line: [(&Handle<HalfEdge>, impl Into<Point<1>>); 2],
services: &mut Services,
) -> Self {
) -> (Self, [Handle<Face>; 2]) {
// The code below might assume that the half-edges that define the line
// are part of the face's exterior. Let's make that explicit here.
//
Expand Down Expand Up @@ -164,6 +164,9 @@ impl SplitFace for Shell {
.insert(services);

let faces = [split_face_a, split_face_b];
self_.replace_face(updated_face_after_split_edges, |_| faces)
let self_ = self_
.replace_face(updated_face_after_split_edges, |_| faces.clone());

(self_, faces)
}
}
2 changes: 1 addition & 1 deletion models/split/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn model(
(cycle.half_edges().nth(2).unwrap(), [split_pos]),
];

shell.split_face(face, line, services).insert(services)
shell.split_face(face, line, services).0.insert(services)
})
.insert(services)
}

0 comments on commit 21fbc2b

Please sign in to comment.