Skip to content
Snippets Groups Projects
Unverified Commit 9870cb40 authored by midlik's avatar midlik Committed by GitHub
Browse files

Fixed degenerate case (1-point) in PCA (#725)

* Fixed degenerate case (1-point) in PCA - now correctly returns identity matrix

* Changelog
parent b2924761
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ Note that since we don't clearly distinguish between a public and private interf
## [Unreleased]
Fix impostor bond visuals not correctly updating on `sizeFactor` changes
Fix degenerate case in PCA
## [v3.31.2] - 2023-02-12
......
......@@ -27,7 +27,7 @@ namespace PrincipalAxes {
export function calculateMomentsAxes(positions: NumberArray): Axes3D {
if (positions.length === 3) {
return Axes3D.create(Vec3.fromArray(Vec3(), positions, 0), Vec3.create(1, 0, 0), Vec3.create(0, 1, 0), Vec3.create(0, 1, 0));
return Axes3D.create(Vec3.fromArray(Vec3(), positions, 0), Vec3.create(1, 0, 0), Vec3.create(0, 1, 0), Vec3.create(0, 0, 1));
}
const points = Matrix.fromArray(positions, 3, positions.length / 3);
......@@ -143,4 +143,4 @@ namespace PrincipalAxes {
return Axes3D.create(origin, dirA, dirB, dirC);
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment