Skip to content

Commit

Permalink
Merge pull request #278 from hannobraun/validation
Browse files Browse the repository at this point in the history
Enable vertex validation
  • Loading branch information
hannobraun authored Mar 15, 2022
2 parents 4cf110e + c1411ba commit b3b7967
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/kernel/shape/topology.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::collections::HashSet;

use tracing::warn;

use crate::{
debug::DebugInfo,
kernel::{
Expand Down Expand Up @@ -63,10 +61,7 @@ impl Topology<'_> {
(existing.get().point() - vertex.point()).magnitude();

if distance < self.min_distance {
warn!(
"Invalid vertex: {vertex:?}; \
identical vertex at {existing:?}",
);
return Err(ValidationError::Uniqueness);
}
}

Expand Down Expand Up @@ -295,9 +290,9 @@ mod tests {

// `point` is too close to the original point. `assert!` is commented,
// because that only causes a warning to be logged right now.
let point = shape.geometry().add_point(Point::from([5e-6, 0., 0.]));
let _result = shape.topology().add_vertex(Vertex { point });
// assert!(matches!(result, Err(ValidationError::Uniqueness)));
let point = shape.geometry().add_point(Point::from([5e-8, 0., 0.]));
let result = shape.topology().add_vertex(Vertex { point });
assert!(matches!(result, Err(ValidationError::Uniqueness)));

// `point` is farther than `MIN_DISTANCE` away from original point.
// Should work.
Expand Down

0 comments on commit b3b7967

Please sign in to comment.