Skip to content

Commit

Permalink
Enable vertex validation
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Mar 11, 2022
1 parent 9b90402 commit a834107
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 @@ -64,10 +62,7 @@ impl Topology<'_> {
let distance = (existing.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 @@ -289,9 +284,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 a834107

Please sign in to comment.