Class QuaternionAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent Quaternion assertions. Distinguishes component-wise equality
(treats q and -q as different) from rotational equivalence (treats them
as the same rotation, the SO(3) double-cover view).
public static class QuaternionAssertions
- Inheritance
-
QuaternionAssertions
- Inherited Members
Remarks
v0.2.0 enriches the failure messages for IsApproximatelyEqualTo(Quaternion, Quaternion, double) and IsRotationallyEquivalentTo(Quaternion, Quaternion, double) with per-component delta rendering via MathAssertions.MathFailureMessage. v0.2.0 also adds HasAxisAngleApproximately(Quaternion, Vector3, double, double) for axis-angle-form rotation assertions.
Methods
HasAxisAngleApproximately(Quaternion, Vector3, double, double)
Asserts the quaternion, viewed as a rotation in axis-angle form, lies within tolerance
of the rotation expectedAngleDegrees degrees around
expectedAxis. Handles the SO(3) double cover so a q / -q
pair both compare equivalent to the same axis-angle pair. See
HasAxisAngleApproximately(Quaternion, Vector3, double, double) for the full contract.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult HasAxisAngleApproximately(this Quaternion value, Vector3 expectedAxis, double expectedAngleDegrees, double tolerance)
Parameters
valueQuaternionexpectedAxisVector3expectedAngleDegreesdoubletolerancedouble
Returns
- AssertionResult
IsApproximatelyEqualTo(Quaternion, Quaternion, double)
Component-wise tolerance comparison.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsApproximatelyEqualTo(this Quaternion value, Quaternion expected, double tolerance)
Parameters
valueQuaternionexpectedQuaterniontolerancedouble
Returns
- AssertionResult
IsIdentity(Quaternion, double)
Asserts the quaternion is the identity quaternion within tolerance.
[GenerateAssertion(ExpectationMessage = "to be the identity quaternion within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsIdentity(this Quaternion value, double tolerance)
Parameters
valueQuaterniontolerancedouble
Returns
IsNormalized(Quaternion, double)
Asserts the quaternion has unit length within tolerance.
[GenerateAssertion(ExpectationMessage = "to be a unit quaternion within tolerance {tolerance}", InlineMethodBody = true)]
public static bool IsNormalized(this Quaternion value, double tolerance)
Parameters
valueQuaterniontolerancedouble
Returns
IsRotationallyEquivalentTo(Quaternion, Quaternion, double)
Asserts the quaternion encodes the same rotation as expected
within tolerance, treating q and -q as equivalent.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsRotationallyEquivalentTo(this Quaternion value, Quaternion expected, double tolerance)
Parameters
valueQuaternionexpectedQuaterniontolerancedouble
Returns
- AssertionResult