Simplify CurveBoundary::normalize

The additional `bool` return value was confusing and easy to misuse.
Callers that need this information can use `is_normalized`, which should
result in clearer (if a bit more verbose) code.
This commit is contained in:
Hanno Braun 2023-08-11 12:51:27 +02:00
parent bf60afae7d
commit 5fb76e8a02
2 changed files with 5 additions and 8 deletions

View File

@ -45,11 +45,11 @@ impl<T: CurveBoundaryElement> CurveBoundary<T> {
/// ///
/// This can be used to compare a boundary while disregarding its direction. /// This can be used to compare a boundary while disregarding its direction.
#[must_use] #[must_use]
pub fn normalize(self) -> (Self, bool) { pub fn normalize(self) -> Self {
if self.is_normalized() { if self.is_normalized() {
(self, false) self
} else { } else {
(self.reverse(), true) self.reverse()
} }
} }
} }

View File

@ -235,7 +235,6 @@ impl ShellValidationError {
.bounding_vertices_of_edge(edge) .bounding_vertices_of_edge(edge)
.expect("Expected edge to be part of shell") .expect("Expected edge to be part of shell")
.normalize() .normalize()
.0
}; };
bounding_vertices_of(edge_a) bounding_vertices_of(edge_a)
@ -315,8 +314,7 @@ impl ShellValidationError {
.expect( .expect(
"Cycle should provide bounds of its own half-edge", "Cycle should provide bounds of its own half-edge",
) )
.normalize() .normalize();
.0;
let edge = (curve, bounding_vertices); let edge = (curve, bounding_vertices);
@ -396,8 +394,7 @@ impl ShellValidationError {
.expect( .expect(
"Just got edge from this cycle; must be part of it", "Just got edge from this cycle; must be part of it",
) )
.normalize() .normalize();
.0;
edges_by_coincidence edges_by_coincidence
.entry((curve, boundary)) .entry((curve, boundary))