Skip to content

Commit

Permalink
Clean up watertight test
Browse files Browse the repository at this point in the history
  • Loading branch information
A-Walrus committed Jul 29, 2023
1 parent 8a8b34f commit 5270e15
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/fj-core/src/validate/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,21 +245,21 @@ impl ShellValidationError {
errors.push(Self::NotWatertight.into());
}

let mut half_edge_to_faces: HashMap<ObjectId, usize> = HashMap::new();
let mut global_edge_to_faces: HashMap<ObjectId, usize> = HashMap::new();

for face in shell.faces() {
for cycle in face.region().all_cycles() {
for half_edge in cycle.half_edges() {
let id = half_edge.global_form().id();
let entry = half_edge_to_faces.entry(id);
let entry = global_edge_to_faces.entry(id);
*entry.or_insert(0) += 1;
}
}
}

// Each global edge should have exactly two half edges that are part of
// the shell
if half_edge_to_faces.iter().any(|(_, c)| *c != 2) {
if global_edge_to_faces.iter().any(|(_, c)| *c != 2) {
errors.push(Self::NotWatertight.into())
}
}
Expand Down

0 comments on commit 5270e15

Please sign in to comment.