mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpimath] Add tolerance for Rotation3d rotation matrix special orthogonality (#4744)
This commit is contained in:
@@ -101,7 +101,7 @@ public class Rotation3d implements Interpolatable<Rotation3d> {
|
||||
|
||||
// Require that the rotation matrix is special orthogonal. This is true if
|
||||
// the matrix is orthogonal (RRᵀ = I) and normalized (determinant is 1).
|
||||
if (!R.times(R.transpose()).equals(Matrix.eye(Nat.N3()))) {
|
||||
if (R.times(R.transpose()).minus(Matrix.eye(Nat.N3())).normF() > 1e-9) {
|
||||
var builder = new StringBuilder("Rotation matrix isn't orthogonal\n\nR =\n");
|
||||
builder.append(R.getStorage().toString()).append('\n');
|
||||
|
||||
@@ -109,7 +109,7 @@ public class Rotation3d implements Interpolatable<Rotation3d> {
|
||||
MathSharedStore.reportError(msg, Thread.currentThread().getStackTrace());
|
||||
throw new IllegalArgumentException(msg);
|
||||
}
|
||||
if (R.det() != 1.0) {
|
||||
if (Math.abs(R.det() - 1.0) > 1e-9) {
|
||||
var builder =
|
||||
new StringBuilder("Rotation matrix is orthogonal but not special orthogonal\n\nR =\n");
|
||||
builder.append(R.getStorage().toString()).append('\n');
|
||||
|
||||
Reference in New Issue
Block a user