Move HalfEdgeHasNoSibling to ValidationError

This commit is contained in:
Hanno Braun 2024-05-21 21:54:36 +02:00
parent 7885e699ba
commit f165c25faa
2 changed files with 7 additions and 11 deletions

View File

@ -29,9 +29,7 @@ impl Validate for Shell {
.map(Into::into),
);
errors.extend(
HalfEdgeHasNoSibling::check(self, geometry, config)
.map(ShellValidationError::HalfEdgeHasNoSibling)
.map(Into::into),
HalfEdgeHasNoSibling::check(self, geometry, config).map(Into::into),
);
ShellValidationError::check_half_edge_coincidence(
self, geometry, config, errors,
@ -42,10 +40,6 @@ impl Validate for Shell {
/// [`Shell`] validation failed
#[derive(Clone, Debug, thiserror::Error)]
pub enum ShellValidationError {
/// [`Shell`] contains a half-edge that is not part of a pair
#[error(transparent)]
HalfEdgeHasNoSibling(HalfEdgeHasNoSibling),
/// [`Shell`] contains half-edges that are coincident, but aren't siblings
#[error(
"`Shell` contains `HalfEdge`s that are coincident but are not \
@ -293,9 +287,7 @@ mod tests {
assert_contains_err!(
core,
invalid,
ValidationError::Shell(
ShellValidationError::HalfEdgeHasNoSibling { .. }
)
ValidationError::HalfEdgeHasNoSibling { .. }
);
Ok(())

View File

@ -6,7 +6,7 @@ use crate::validate::{
use super::checks::{
AdjacentHalfEdgesNotConnected, CurveGeometryMismatch, FaceHasNoBoundary,
InteriorCycleHasInvalidWinding,
HalfEdgeHasNoSibling, InteriorCycleHasInvalidWinding,
};
/// An error that can occur during a validation
@ -24,6 +24,10 @@ pub enum ValidationError {
#[error(transparent)]
FaceHasNoBoundary(#[from] FaceHasNoBoundary),
/// Half-edge has no sibling
#[error(transparent)]
HalfEdgeHasNoSibling(#[from] HalfEdgeHasNoSibling),
/// Interior cycle has invalid winding
#[error(transparent)]
InteriorCycleHasInvalidWinding(#[from] InteriorCycleHasInvalidWinding),