Skip to content

Commit

Permalink
Add additional unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderFabisch committed Jun 29, 2023
1 parent 2ae847d commit 36379b1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pytransform3d/test/test_geometry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import numpy as np

import pytransform3d.geometry as pg
import pytransform3d.transformations as pt
from numpy.testing import assert_array_equal, assert_array_almost_equal


Expand All @@ -13,3 +14,15 @@ def test_unit_sphere():
P = np.column_stack((x.reshape(-1), y.reshape(-1), z.reshape(-1)))
norms = np.linalg.norm(P, axis=1)
assert_array_almost_equal(norms, np.ones_like(norms))


def test_transform_surface():
x, y, z = pg.unit_sphere_surface_grid(10)

p = np.array([0.2, -0.5, 0.7])
pose = pt.transform_from(R=np.eye(3), p=p)
x, y, z = pg.transform_surface(pose, x, y, z)

P = np.column_stack((x.reshape(-1), y.reshape(-1), z.reshape(-1)))
norms = np.linalg.norm(P - p[np.newaxis], axis=1)
assert_array_almost_equal(norms, np.ones_like(norms))

0 comments on commit 36379b1

Please sign in to comment.