From c1411baeef9c98282582000e3797abb248a6fe9e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 2 Mar 2022 19:22:22 +0100 Subject: [PATCH] Enable vertex validation --- src/kernel/shape/topology.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/kernel/shape/topology.rs b/src/kernel/shape/topology.rs index 27e4b7b62..c2ef2eab5 100644 --- a/src/kernel/shape/topology.rs +++ b/src/kernel/shape/topology.rs @@ -1,7 +1,5 @@ use std::collections::HashSet; -use tracing::warn; - use crate::{ debug::DebugInfo, kernel::{ @@ -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); } } @@ -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.