`shortest_path` bug in `unitquat_to_rotvec()`
Closed this issue · 5 comments
low5545 commented
Lines 255 to 280 in 22806df
- On Line 272,
q1 = -torch.sign(torch.sum(q0*q1, dim=-1, keepdim=True)) * q1
should beq1 = torch.sign(torch.sum(q0*q1, dim=-1, keepdim=True)) * q1
, since one of the quaternions only need to be flipped when$cos \Omega < 0$ , hence dot product$< 0$ - The
shortest_path
flag is actually useless, sinceunitquat_to_rotvec()
(used on L275) always returns rotation vectors with angles within$[0, \pi]$
rbregier commented
Thank you for opening this issue !
Indeed, it seems that the current implementation of this function is bugged:
- As you mentioned, slerp is always performed along the shortest arc here.
- Additionally,
torch.sign
could return 0 in some (rare) cases, leading to a wrong interpolation (i.e. ignoringq1
and returningq0
).
These bugs must have appeared during the refactoring of the code, before open-sourcing the library. I will try to fix them in the next release.
Again, thanks for reporting the issue.
rbregier commented
The issue should be solved with the commit c460d15.
I will try to push a new pip release next week, with some minor additional features.
rbregier commented
Version 1.3.0 should have solved the issue. Thank you for the feedback, and feel free to reopen the issue if needed.
low5545 commented