Skip to content

Commit

Permalink
Avoid ambiguous normals in best-fit plane tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Nov 23, 2024
1 parent 2066c1b commit 41cfdae
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 11 additions & 2 deletions src/lapack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -114,7 +115,11 @@ mod tests {
EuclideanSpace::from_xyz(0.0, 0.0, 0.0),
])
.unwrap();
assert_abs_diff_eq!(Vector::<E3>::z(), plane.normal.get().clone());
assert_abs_diff_eq!(
Vector::<E3>::z(),
// The axial direction of the normal is ambiguous.
plane.normal.get().clone().map(f64::abs),

Check failure on line 121 in src/lapack.rs

View workflow job for this annotation

GitHub Actions / Lint

using `clone` on type `Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>` which implements the `Copy` trait
);
}

#[test]
Expand All @@ -128,6 +133,10 @@ mod tests {
EuclideanSpace::from_xyz(2.0, 3.0, 0.0),
])
.unwrap();
assert_abs_diff_eq!(Vector::<E3>::z(), plane.normal.get().clone());
assert_abs_diff_eq!(
Vector::<E3>::z(),
// The axial direction of the normal is ambiguous.
plane.normal.get().clone().map(f64::abs),

Check failure on line 139 in src/lapack.rs

View workflow job for this annotation

GitHub Actions / Lint

using `clone` on type `Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>` which implements the `Copy` trait
);
}
}

0 comments on commit 41cfdae

Please sign in to comment.