Skip to content

Commit

Permalink
fix transformation matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Koubaa committed Apr 4, 2024
1 parent ac75627 commit 5171075
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ansys/mechanical/core/embedding/viz/pyvista_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@


def _transform_to_pyvista(transform):
return np.array([transform[i] for i in range(16)]).reshape(4, 4).transpose()
np_transform = np.array([transform[i] for i in range(16)]).reshape(4, 4)
# There's a bug in mechanical, the scenegraph wrappers use theMatrix4D
# type, which puts the tranformations in the transposed location relative
# to pyvista. But they use the same matrix layout as pyvista, so that
# doesn't conform to the expectations of Matrix4D. When it is fixed there,
# the below line has to be uncommented

# np_transform = np_transform.transpose()
return np_transform


def _reshape_3cols(arr: np.array, name: str):
Expand Down

0 comments on commit 5171075

Please sign in to comment.