Class MatrixAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent Matrix4x4 assertions covering element-wise equality and the matrix invariants from LinearAlgebra.
public static class MatrixAssertions
- Inheritance
-
MatrixAssertions
- Inherited Members
Remarks
v0.2.0 enriches the failure message for IsApproximatelyEqualTo(Matrix4x4, Matrix4x4, double) with the
list of [row, col] cells whose absolute delta exceeded tolerance via
MathAssertions.MathFailureMessage.
Methods
HasDeterminantApproximately(Matrix4x4, double, double)
Asserts the matrix determinant is approximately expected.
[GenerateAssertion(ExpectationMessage = "to have determinant approximately {expected} within tolerance {tolerance}", InlineMethodBody = true)]
public static bool HasDeterminantApproximately(this Matrix4x4 value, double expected, double tolerance)
Parameters
Returns
HasTraceApproximately(Matrix4x4, double, double)
Asserts the matrix trace is approximately expected.
[GenerateAssertion(ExpectationMessage = "to have trace approximately {expected} within tolerance {tolerance}", InlineMethodBody = true)]
public static bool HasTraceApproximately(this Matrix4x4 value, double expected, double tolerance)
Parameters
Returns
IsApproximatelyEqualTo(Matrix4x4, Matrix4x4, double)
Element-wise tolerance comparison across all sixteen elements.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsApproximatelyEqualTo(this Matrix4x4 value, Matrix4x4 expected, double tolerance)
Parameters
Returns
- AssertionResult
IsIdentity(Matrix4x4, double)
Asserts the matrix is the identity matrix within tolerance.
[GenerateAssertion(ExpectationMessage = "to be the identity matrix within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsIdentity(this Matrix4x4 value, double tolerance)
Parameters
Returns
IsInvertible(Matrix4x4, double)
Asserts the absolute determinant exceeds tolerance.
[GenerateAssertion(ExpectationMessage = "to be invertible (|det| > tolerance {tolerance})", InlineMethodBody = true)]
public static bool IsInvertible(this Matrix4x4 value, double tolerance)
Parameters
Returns
IsOrthogonal(Matrix4x4, double)
Asserts the matrix is orthogonal (M*M^T = I) within tolerance.
[GenerateAssertion(ExpectationMessage = "to be orthogonal within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsOrthogonal(this Matrix4x4 value, double tolerance)
Parameters
Returns
IsRotation(Matrix4x4, double)
Asserts the matrix is a proper rotation (orthogonal with determinant +1)
within tolerance. Reflections (determinant -1) and matrices carrying a translation
or scale are rejected.
[GenerateAssertion(ExpectationMessage = "to be a proper rotation within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsRotation(this Matrix4x4 value, double tolerance)
Parameters
Returns
IsSymmetric(Matrix4x4, double)
Asserts the matrix is symmetric (each off-diagonal pair mirror-equal) within tolerance.
[GenerateAssertion(ExpectationMessage = "to be symmetric within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsSymmetric(this Matrix4x4 value, double tolerance)