From 41cfdae655bc2221c0dd35522a4515fac9f0c684 Mon Sep 17 00:00:00 2001 From: Sean Olson Date: Fri, 22 Nov 2024 17:32:05 -0800 Subject: [PATCH] Avoid ambiguous normals in best-fit plane tests. --- Cargo.toml | 6 +++++- src/lapack.rs | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3ef7aef..2c5517b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,13 @@ edition = "2021" rust-version = "1.56.0" license = "MIT" keywords = [ + "euclidean", "geometry", + "linear", +] +categories = [ "graphics", - "math", + "mathematics", ] [package.metadata.docs.rs] diff --git a/src/lapack.rs b/src/lapack.rs index 4203c70..e2a208f 100644 --- a/src/lapack.rs +++ b/src/lapack.rs @@ -101,6 +101,7 @@ mod tests { use approx::assert_abs_diff_eq; use nalgebra::Point3; + use crate::adjunct::Map; use crate::query::Plane; use crate::space::{EuclideanSpace, Vector}; @@ -114,7 +115,11 @@ mod tests { EuclideanSpace::from_xyz(0.0, 0.0, 0.0), ]) .unwrap(); - assert_abs_diff_eq!(Vector::::z(), plane.normal.get().clone()); + assert_abs_diff_eq!( + Vector::::z(), + // The axial direction of the normal is ambiguous. + plane.normal.get().clone().map(f64::abs), + ); } #[test] @@ -128,6 +133,10 @@ mod tests { EuclideanSpace::from_xyz(2.0, 3.0, 0.0), ]) .unwrap(); - assert_abs_diff_eq!(Vector::::z(), plane.normal.get().clone()); + assert_abs_diff_eq!( + Vector::::z(), + // The axial direction of the normal is ambiguous. + plane.normal.get().clone().map(f64::abs), + ); } }