Skip to content

Commit 5c432b3

Browse files
committed
add unit test coverage
1 parent e7b6eda commit 5c432b3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_pose3d.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,35 @@ def test_arith_vect(self):
12601260
array_compare(a[1], ry - 1)
12611261
array_compare(a[2], rz - 1)
12621262

1263+
def test_angle(self):
1264+
# angle between SO3's
1265+
r1 = SO3.Rx(0.1)
1266+
r2 = SO3.Rx(0.2)
1267+
for metric in range(6):
1268+
self.assertAlmostEqual(r1.angdist(other=r1, metric=metric), 0.0)
1269+
self.assertGreater(r1.angdist(other=r2, metric=metric), 0.0)
1270+
self.assertAlmostEqual(
1271+
r1.angdist(other=r2, metric=metric), r2.angdist(other=r1, metric=metric)
1272+
)
1273+
# angle between SE3's
1274+
p1a, p1b = SE3.Rx(0.1), SE3.Rx(0.1, t=(1, 2, 3))
1275+
p2a, p2b = SE3.Rx(0.2), SE3.Rx(0.2, t=(3, 2, 1))
1276+
for metric in range(6):
1277+
self.assertAlmostEqual(p1a.angdist(other=p1a, metric=metric), 0.0)
1278+
self.assertGreater(p1a.angdist(other=p2a, metric=metric), 0.0)
1279+
self.assertAlmostEqual(p1a.angdist(other=p1b, metric=metric), 0.0)
1280+
self.assertAlmostEqual(
1281+
p1a.angdist(other=p2a, metric=metric),
1282+
p2a.angdist(other=p1a, metric=metric),
1283+
)
1284+
self.assertAlmostEqual(
1285+
p1a.angdist(other=p2a, metric=metric),
1286+
p1a.angdist(other=p2b, metric=metric),
1287+
)
1288+
# angle between mismatched types
1289+
with self.assertRaises(ValueError):
1290+
_ = r1.angdist(p1a)
1291+
12631292
def test_functions(self):
12641293
# inv
12651294
# .T

0 commit comments

Comments
 (0)