Skip to content

Commit 47bf4be

Browse files
authored
[BUG FIX] Fix viewer crash when initial roll_angle = 0 (#1421)
1 parent 8e47384 commit 47bf4be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

genesis/ext/pyrender/trackball.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def drag(self, point):
113113
if self._state == Trackball.STATE_ROTATE:
114114
# Compute updated azimut directly. No fancy math here because this angle can controlled freely.
115115
roll_angle = np.arctan2(self._pose[2, 1], self._pose[2, 2])
116-
world_up_axis = np.array([0.0, 0.0, np.sign(roll_angle)])
116+
world_up_axis = np.array([0.0, 0.0, -1.0 if roll_angle < 0.0 else 1.0]) # safeguard for degenerate case when roll_angle = 0
117117
azimuth_angle = -dx / mindim
118118
azimuth_transform = transformations.rotation_matrix(azimuth_angle, world_up_axis, target)
119119

0 commit comments

Comments
 (0)