Skip to content

Commit

Permalink
revert the revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelvinrr committed Jan 17, 2025
1 parent 9e39926 commit bf2fd07
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
34 changes: 17 additions & 17 deletions ale/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,23 +198,23 @@ def quats(self):
"""
quats = self._rots.as_quat()

# # First find the largest magnitude quaternion coefficient and its coordinate
# num_quats = len(quats)
# max_q = 0.0
# max_j = 0
# for i in range(num_quats):
# for j in range(4):
# if abs(quats[i][j]) > abs(max_q):
# max_q = quats[i][j]
# max_j = j

# # Ensure the signs are consistent
# qcnt = 0
# for i in range(num_quats):
# if quats[i][max_j] * max_q < 0:
# qcnt = qcnt + 1
# for j in range(4):
# quats[i][j] *= -1.0
# First find the largest magnitude quaternion coefficient and its coordinate
num_quats = len(quats)
max_q = 0.0
max_j = 0
for i in range(num_quats):
for j in range(4):
if abs(quats[i][j]) > abs(max_q):
max_q = quats[i][j]
max_j = j

# Ensure the signs are consistent
qcnt = 0
for i in range(num_quats):
if quats[i][max_j] * max_q < 0:
qcnt = qcnt + 1
for j in range(4):
quats[i][j] *= -1.0

return quats

Expand Down
8 changes: 4 additions & 4 deletions tests/pytests/data/isds/dawnvir_isd.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@
],
"quaternions": [
[
-0.08339426680875163,
0.2825790922154143,
-0.2899354389711647,
0.9105667982826637
0.08339426680875163,
-0.2825790922154143,
0.2899354389711647,
-0.9105667982826637
],
[
-0.05753008804150366,
Expand Down

0 comments on commit bf2fd07

Please sign in to comment.