From 8b73cf8140dc917fc7673977ed41714b8f7831d1 Mon Sep 17 00:00:00 2001 From: Joris Vaillant Date: Fri, 13 Dec 2024 13:40:24 +0100 Subject: [PATCH] python: Add type annotation and assert on size --- bindings/python/pinocchio/visualize/meshcat_visualizer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bindings/python/pinocchio/visualize/meshcat_visualizer.py b/bindings/python/pinocchio/visualize/meshcat_visualizer.py index 1b8a3282b..395766f09 100644 --- a/bindings/python/pinocchio/visualize/meshcat_visualizer.py +++ b/bindings/python/pinocchio/visualize/meshcat_visualizer.py @@ -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