From d6673a718154158bb351e1c551af231753ec0d35 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 1 Feb 2023 13:19:33 +0100 Subject: [PATCH 1/2] Improve formatting --- crates/fj-kernel/src/validate/vertex.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/validate/vertex.rs b/crates/fj-kernel/src/validate/vertex.rs index b8e393774..ba84dc975 100644 --- a/crates/fj-kernel/src/validate/vertex.rs +++ b/crates/fj-kernel/src/validate/vertex.rs @@ -29,10 +29,10 @@ pub enum SurfaceVertexValidationError { /// Mismatch between position and position of global form #[error( "`SurfaceVertex` position doesn't match position of its global form\n\ - - `SurfaceVertex`: {surface_vertex:#?}\n\ - - `GlobalVertex`: {global_vertex:#?}\n\ - - `SurfaceVertex` position as global: {surface_position_as_global:?}\n\ - - Distance between the positions: {distance}" + - `SurfaceVertex`: {surface_vertex:#?}\n\ + - `GlobalVertex`: {global_vertex:#?}\n\ + - `SurfaceVertex` position as global: {surface_position_as_global:?}\n\ + - Distance between the positions: {distance}" )] PositionMismatch { /// The surface vertex From 03b06ebafa255784e882704276918537b71837c1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 1 Feb 2023 13:24:08 +0100 Subject: [PATCH 2/2] Improve validation error message --- crates/fj-kernel/src/validate/vertex.rs | 28 +++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/crates/fj-kernel/src/validate/vertex.rs b/crates/fj-kernel/src/validate/vertex.rs index ba84dc975..edd00113e 100644 --- a/crates/fj-kernel/src/validate/vertex.rs +++ b/crates/fj-kernel/src/validate/vertex.rs @@ -29,23 +29,28 @@ pub enum SurfaceVertexValidationError { /// Mismatch between position and position of global form #[error( "`SurfaceVertex` position doesn't match position of its global form\n\ - - `SurfaceVertex`: {surface_vertex:#?}\n\ - - `GlobalVertex`: {global_vertex:#?}\n\ - - `SurfaceVertex` position as global: {surface_position_as_global:?}\n\ - - Distance between the positions: {distance}" + - Surface position: {surface_position:?}\n\ + - Surface position converted to global position: \ + {surface_position_as_global:?}\n\ + - Global position: {global_position:?}\n\ + - Distance between the positions: {distance}\n\ + - `SurfaceVertex`: {surface_vertex:#?}" )] PositionMismatch { - /// The surface vertex - surface_vertex: SurfaceVertex, - - /// The mismatched global vertex - global_vertex: GlobalVertex, + /// The position of the surface vertex + surface_position: Point<2>, /// The surface position converted into a global position surface_position_as_global: Point<3>, + /// The position of the global vertex + global_position: Point<3>, + /// The distance between the positions distance: Scalar, + + /// The surface vertex + surface_vertex: SurfaceVertex, }, } @@ -66,10 +71,11 @@ impl SurfaceVertexValidationError { if distance > config.identical_max_distance { errors.push( Box::new(Self::PositionMismatch { - surface_vertex: surface_vertex.clone(), - global_vertex: surface_vertex.global_form().clone_object(), + surface_position: surface_vertex.position(), surface_position_as_global, + global_position, distance, + surface_vertex: surface_vertex.clone(), }) .into(), );