diff --git a/ale/rotation.py b/ale/rotation.py index d511117de..eaded5785 100644 --- a/ale/rotation.py +++ b/ale/rotation.py @@ -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 diff --git a/tests/pytests/data/isds/dawnvir_isd.json b/tests/pytests/data/isds/dawnvir_isd.json index 90674bb71..01c3df4d1 100644 --- a/tests/pytests/data/isds/dawnvir_isd.json +++ b/tests/pytests/data/isds/dawnvir_isd.json @@ -339,10 +339,10 @@ ], "quaternions": [ [ - -0.08339426680875163, - 0.2825790922154143, - -0.2899354389711647, - 0.9105667982826637 + 0.08339426680875163, + -0.2825790922154143, + 0.2899354389711647, + -0.9105667982826637 ], [ -0.05753008804150366,