Commit 73b415bd authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

unit tests for rmsdev function

parent 6d1802e6
......@@ -537,3 +537,34 @@ def test_sformToFlirtMatrix():
assert np.all(np.isclose(result1, expected))
assert np.all(np.isclose(result2, expected))
def test_rmsdev():
t1 = np.eye(4)
t2 = transform.scaleOffsetXform([1, 1, 1], [2, 0, 0])
assert np.isclose(transform.rmsdev(t1, t2), 2)
assert np.isclose(transform.rmsdev(t1, t2, R=2), 2)
assert np.isclose(transform.rmsdev(t1, t2, R=2, xc=(1, 1, 1)), 2)
t1 = np.eye(3)
lastdist = 0
for i in range(1, 11):
rot = np.pi * i / 10.0
t2 = transform.axisAnglesToRotMat(rot, 0, 0)
result = transform.rmsdev(t1, t2)
assert result > lastdist
lastdist = result
for i in range(11, 20):
rot = np.pi * i / 10.0
t2 = transform.axisAnglesToRotMat(rot, 0, 0)
result = transform.rmsdev(t1, t2)
assert result < lastdist
lastdist = result
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment