Skip to content

Commit

Permalink
python: Add type annotation and assert on size
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Dec 13, 2024
1 parent ee3fda7 commit 8b73cf8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bindings/python/pinocchio/visualize/meshcat_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ def hasMeshFileInfo(geometry_object):
return False


def applyScalingOnHomegeneousTransform(homogeneous_transform, scale):
scale = np.asarray(scale).flatten()
def applyScalingOnHomegeneousTransform(
homogeneous_transform: np.ndarray, scale: np.ndarray
) -> np.ndarray:
assert homogeneous_transform.shape == (4, 4)
assert scale.shape == (3,)
scale = np.array(scale).flatten()
S = np.diag(np.concatenate((scale, [1.0])))
return homogeneous_transform @ S

Expand Down

0 comments on commit 8b73cf8

Please sign in to comment.