From b1602de42308c5a16056786f33e8d8ca99af7e35 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 14 Jul 2023 10:24:44 +0200 Subject: [PATCH 1/4] Remove obsolete information from doc comment --- crates/fj-core/src/objects/kinds/edge.rs | 4 ---- 1 file changed, 4 deletions(-) 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() } From c9e7045b1f1920a70a0d4311ebb5a65f2c6783f7 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 14 Jul 2023 10:36:25 +0200 Subject: [PATCH 2/4] Improve formatting --- crates/fj-core/src/validate/cycle.rs | 1 + crates/fj-core/src/validate/shell.rs | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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..8076277ce 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -28,7 +28,8 @@ pub enum ShellValidationError { #[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\ @@ -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 @@ -173,6 +176,7 @@ impl ShellValidationError { ) { let faces = shell.faces(); let mut half_edge_to_faces: HashMap = HashMap::new(); + for face in faces { for cycle in face.region().all_cycles() { for half_edge in cycle.half_edges() { @@ -183,7 +187,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()) } From 933518270481ff40a385abe6c7c12d2031fadf5d Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 14 Jul 2023 10:43:42 +0200 Subject: [PATCH 3/4] Fix words in documentation --- crates/fj-core/src/validate/shell.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 8076277ce..228bdd46c 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -24,11 +24,11 @@ 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 + /// [`Shell`] contains half-edges that are coincident, but refer to /// different global_edges #[error( "`Shell` contains `HalfEdge`s that are coincident but refer to \ @@ -38,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\ From 5fbfb2a583a316dbaa35880989e2a0095f6e1855 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 14 Jul 2023 11:19:03 +0200 Subject: [PATCH 4/4] Inline redundant variable --- crates/fj-core/src/validate/shell.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 228bdd46c..5e42e65f1 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -174,10 +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();