Skip to content

Commit

Permalink
Merge pull request #1113 from JeffreyWardman/handle-empty-axis-for-ro…
Browse files Browse the repository at this point in the history
…tation

handle empty axis for rotation
  • Loading branch information
marcomusy authored May 8, 2024
2 parents d9c1483 + 4f4b13d commit 70dcce9
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 np.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 70dcce9

Please sign in to comment.