Refactor to prepare for follow-on change

This commit is contained in:
Hanno Braun 2024-05-21 21:45:12 +02:00
parent 43b924ed69
commit 187a943e18

View File

@ -28,7 +28,9 @@ impl Validate for Shell {
CurveGeometryMismatch::check(self, geometry, config) CurveGeometryMismatch::check(self, geometry, config)
.map(Into::into), .map(Into::into),
); );
ShellValidationError::check_half_edge_pairs(self, geometry, errors); errors.extend(ShellValidationError::check_half_edge_pairs(
self, geometry,
));
ShellValidationError::check_half_edge_coincidence( ShellValidationError::check_half_edge_coincidence(
self, geometry, config, errors, self, geometry, config, errors,
); );
@ -75,8 +77,7 @@ impl ShellValidationError {
fn check_half_edge_pairs<'r>( fn check_half_edge_pairs<'r>(
shell: &'r Shell, shell: &'r Shell,
geometry: &'r Geometry, geometry: &'r Geometry,
errors: &'r mut Vec<ValidationError>, ) -> impl Iterator<Item = ValidationError> + 'r {
) {
let mut unmatched_half_edges = BTreeMap::new(); let mut unmatched_half_edges = BTreeMap::new();
for face in shell.faces() { for face in shell.faces() {
@ -113,12 +114,13 @@ impl ShellValidationError {
} }
} }
errors.extend(unmatched_half_edges.into_values().cloned().map( unmatched_half_edges
|half_edge| { .into_values()
.cloned()
.map(|half_edge| {
Self::HalfEdgeHasNoSibling(HalfEdgeHasNoSibling { half_edge }) Self::HalfEdgeHasNoSibling(HalfEdgeHasNoSibling { half_edge })
.into() .into()
}, })
));
} }
/// Check that non-sibling half-edges are not coincident /// Check that non-sibling half-edges are not coincident