From 7a49f1611e2959ccf9c6c92f9d518458a4d88f9e Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 13 Jan 2025 14:43:08 +0500 Subject: [PATCH] get_shape_matrix - small optimization reuse existing matrix instead of recreating new --- src/ifcopenshell-python/ifcopenshell/util/shape.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/shape.py b/src/ifcopenshell-python/ifcopenshell/util/shape.py index bc56d6e802..62cdb0d0f0 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/shape.py +++ b/src/ifcopenshell-python/ifcopenshell/util/shape.py @@ -145,7 +145,7 @@ def get_shape_matrix(shape: ShapeElementType) -> MatrixType: :param shape: Shape output calculated by IfcOpenShell :return: A 4x4 numpy array representing the transformation matrix """ - return np.array(shape.transformation.matrix).reshape((4, 4), order="F") + return np.frombuffer(shape.transformation_buffer, "d").reshape((4, 4), order="F") def get_bbox_centroid(geometry: ShapeType) -> tuple[float, float, float]: