Skip to content

Commit

Permalink
handle empty axis for rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Wardman committed May 8, 2024
1 parent d9c1483 commit 08ebe11
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vedo/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,15 @@ def rotate(self, angle, axis=(1, 0, 0), point=(0, 0, 0), rad=False) -> Self:
```
![](https://vedo.embl.es/images/feats/rotate_axis.png)
"""
if all(axis == 0):
return self
if not angle:
return self
if rad:
anglerad = angle
else:
anglerad = np.deg2rad(angle)

axis = np.asarray(axis) / np.linalg.norm(axis)
a = np.cos(anglerad / 2)
b, c, d = -axis * np.sin(anglerad / 2)
Expand Down

0 comments on commit 08ebe11

Please sign in to comment.