diff --git a/crates/fj-core/src/objects/kinds/edge.rs b/crates/fj-core/src/objects/kinds/edge.rs index 3ee79c435..d174ce009 100644 --- a/crates/fj-core/src/objects/kinds/edge.rs +++ b/crates/fj-core/src/objects/kinds/edge.rs @@ -120,10 +120,6 @@ pub struct GlobalEdge {} impl GlobalEdge { /// Create a new instance - /// - /// The order of `vertices` is irrelevant. Two `GlobalEdge`s with the same - /// `curve` and `vertices` will end up being equal, regardless of the order - /// of `vertices` here. pub fn new() -> Self { Self::default() } diff --git a/crates/fj-core/src/validate/cycle.rs b/crates/fj-core/src/validate/cycle.rs index 228e6e3ba..9aa5852a4 100644 --- a/crates/fj-core/src/validate/cycle.rs +++ b/crates/fj-core/src/validate/cycle.rs @@ -40,6 +40,7 @@ pub enum CycleValidationError { /// The half-edge half_edges: Box<(HalfEdge, HalfEdge)>, }, + /// [`Cycle`]'s should have at least one `HalfEdge` #[error("Expected at least one `HalfEdge`\n")] NotEnoughHalfEdges, diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 5769aba06..5e42e65f1 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -24,11 +24,12 @@ impl Validate for Shell { /// [`Shell`] validation failed #[derive(Clone, Debug, thiserror::Error)] pub enum ShellValidationError { - /// [`Shell`] contains global_edges not referred to by two half_edges + /// [`Shell`] contains global_edges not referred to by two half-edges #[error("Shell is not watertight")] NotWatertight, - /// [`Shell`] contains half_edges that are coincident, but refer to different global_edges + /// [`Shell`] contains half-edges that are coincident, but refer to + /// different global_edges #[error( "`Shell` contains `HalfEdge`s that are coincident but refer to \ different `GlobalEdge`s\n\ @@ -37,7 +38,7 @@ pub enum ShellValidationError { )] CoincidentEdgesNotIdentical(Handle, Handle), - /// [`Shell`] contains half_edges that are identical, but do not coincide + /// [`Shell`] contains half-edges that are identical, but do not coincide #[error( "Shell contains HalfEdges that are identical but do not coincide\n\ Edge 1: {edge_1:#?}\n\ @@ -126,7 +127,9 @@ impl ShellValidationError { for other_edge in &edges_and_surfaces { let id = edge.0.global_form().id(); let other_id = other_edge.0.global_form().id(); + let identical = id == other_id; + match identical { true => { // All points on identical curves should be within @@ -171,9 +174,9 @@ impl ShellValidationError { _: &ValidationConfig, errors: &mut Vec, ) { - let faces = shell.faces(); let mut half_edge_to_faces: HashMap = HashMap::new(); - for face in faces { + + 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(); @@ -183,7 +186,8 @@ impl ShellValidationError { } } - // Each global edge should have exactly two half edges that are part of the shell + // 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) { errors.push(Self::NotWatertight.into()) }