Class PoseAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent pose / rigid-transform assertions. A pose is a position and an orientation together; these assertions compare the two halves with separate tolerances (position as a Euclidean distance in the caller's length unit, rotation as a geodesic angle in degrees) and report one combined diagnostic that names which half missed. A single shared tolerance would be wrong because the two quantities carry different units.
public static class PoseAssertions
- Inheritance
-
PoseAssertions
- Inherited Members
Remarks
The orientation comparison is on the SO(3) rotation metric, so a quaternion and its negation
(q and -q) are treated as the same rotation. The Matrix4x4 overload
decomposes each transform into its translation and rotation and compares those; scale is not
part of a rigid transform and is ignored.
Methods
IsPoseApproximatelyEqualTo((Vector3 Position, Quaternion Orientation), (Vector3 Position, Quaternion Orientation), double, double)
Asserts that a (Position, Orientation) pose matches expected within
a Euclidean positionTolerance and a geodesic
rotationToleranceDegrees. On failure the message renders both poses and the
measured position and rotation deltas, flagging which half exceeded its tolerance.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsPoseApproximatelyEqualTo(this (Vector3 Position, Quaternion Orientation) value, (Vector3 Position, Quaternion Orientation) expected, double positionTolerance, double rotationToleranceDegrees)
Parameters
value(Vector3 Position, Quaternion Orientation)The actual pose, as a
(Vector3 Position, Quaternion Orientation)tuple.expected(Vector3 Position, Quaternion Orientation)The expected pose.
positionTolerancedoubleMaximum allowed Euclidean distance between the positions. Non-negative, not NaN.
rotationToleranceDegreesdoubleMaximum allowed geodesic angle between the orientations, in degrees. Non-negative, not NaN.
Returns
- AssertionResult
IsRigidTransformApproximatelyEqualTo(Matrix4x4, Matrix4x4, double, double)
Asserts that a rigid transform (a Matrix4x4) matches expected
in its translation and rotation within separate tolerances. The translation is read from
Translation and the rotation via
CreateFromRotationMatrix(Matrix4x4); the overload assumes a rigid
transform (orthonormal rotation, unit scale), which is the contract its name advertises.
[GenerateAssertion(InlineMethodBody = true)]
public static AssertionResult IsRigidTransformApproximatelyEqualTo(this Matrix4x4 value, Matrix4x4 expected, double positionTolerance, double rotationToleranceDegrees)
Parameters
valueMatrix4x4The actual rigid transform.
expectedMatrix4x4The expected rigid transform.
positionTolerancedoubleMaximum allowed Euclidean distance between the translations. Non-negative, not NaN.
rotationToleranceDegreesdoubleMaximum allowed geodesic angle between the rotations, in degrees. Non-negative, not NaN.
Returns
- AssertionResult