Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions modules/zividsamples/gui/widgets/pose_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,14 @@ def zivid_transformation_matrix(self) -> zivid.Matrix4x4:
return zivid.Matrix4x4(self.transformation_matrix.as_matrix())

def _rotation_label_text(self) -> str:
degrees = (
" (°)"
if self.rotation_information.use_degrees
and self.rotation_information.rotation_format not in ["Quaternion", "Rotation Matrix"]
else (
" (rad)" if self.rotation_information.rotation_format not in ["Quaternion", "Rotation Matrix"] else ""
)
)
return f"Rotation as {self.rotation_information.rotation_format.name}{degrees}"
rotation_format = self.rotation_information.rotation_format
if rotation_format in [RotationFormats.quaternion, RotationFormats.rotation_matrix]:
degrees = ""
elif self.rotation_information.use_degrees:
degrees = " (°)"
else:
degrees = " (rad)"
return f"Rotation as {rotation_format.name}{degrees}"

def _rotation_column_label_texts(self) -> List[str]:
fmt = self.rotation_information.rotation_format
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, axis: np.ndarray = np.array([0, 0, 1]), angle: Optional[float
if angle is None:
self.angle = np.linalg.norm(axis)
self.axis = axis / self.angle
elif np.linalg.norm(axis) != 0:
elif not np.isclose(np.linalg.norm(axis), 1.0):
raise ValueError("Angle provided, but vector is not unit vector")
else:
self.angle: np.floating = np.floating(angle)
Expand Down
Loading