From d2ebc5bbcb2843e0b3507d7585d5df5dac922b3a Mon Sep 17 00:00:00 2001 From: Julian Knodt Date: Tue, 27 May 2025 19:44:46 +0900 Subject: [PATCH] Check instanceof not exact type match Previously this precluded the usage of tracked arrays, which are output from trimesh. Just a small convenience for the user to not have to convert it to a numpy array. --- src/robust_laplacian/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/robust_laplacian/core.py b/src/robust_laplacian/core.py index 612de04..df45967 100644 --- a/src/robust_laplacian/core.py +++ b/src/robust_laplacian/core.py @@ -5,13 +5,13 @@ def mesh_laplacian(verts, faces, mollify_factor=1e-5): ## Validate input - if type(verts) is not np.ndarray: - raise ValueError("`verts` should be a numpy array") + if not isinstance(verts, np.ndarray): + raise ValueError("`verts` should be an instance of numpy array") if (len(verts.shape) != 2) or (verts.shape[1] != 3): raise ValueError("`verts` should have shape (V,3), shape is " + str(verts.shape)) - if type(faces) is not np.ndarray: - raise ValueError("`faces` should be a numpy array") + if not isinstance(faces, np.ndarray): + raise ValueError(f"`faces` should be an instance of numpy array") if (len(faces.shape) != 2) or (faces.shape[1] != 3): raise ValueError("`faces` should have shape (F,3), shape is " + str(faces.shape))