Skip to content

Commit

Permalink
Fix Parametric objects rotate error (#4853)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkoyama010 committed Sep 15, 2023
1 parent 9958146 commit a89da78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyvista/core/utilities/geometric_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def translate(surf, center=(0.0, 0.0, 0.0), direction=(1.0, 0.0, 0.0)):
if np.array_equal(normz, (0.0, 0.0, 0.0)):
# the assumed normy axis is parallel to normx, so shift its
# axis and recalculate normz
norm_y_temp = np.roll(norm_y_temp, 1)
norm_y_temp = [-1.0, 0.0, 0.0]
normz = np.cross(normx, norm_y_temp)
normz /= np.linalg.norm(normz)
normy = np.cross(normz, normx)
Expand Down
12 changes: 12 additions & 0 deletions tests/core/test_parametric_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,15 @@ def test_ParametricSuperToroid():
def test_ParametricTorus():
geom = pv.ParametricTorus()
assert geom.n_points


def test_direction():
geom1 = pv.ParametricEllipsoid(300, 100, 10, direction=[1, 0, 0])
geom2 = pv.ParametricEllipsoid(300, 100, 10, direction=[0, 1, 0])
assert geom1.n_points
assert geom2.n_points
points1 = geom1.points
points2 = geom2.points
assert np.allclose(points1[:, 0], points2[:, 1])
assert np.allclose(points1[:, 1], -points2[:, 0])
assert np.allclose(points1[:, 2], points2[:, 2])

0 comments on commit a89da78

Please sign in to comment.