question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

angle_axis_to_quaternion returns (w, x, y, z) instead of (x, y, z, w)

See original GitHub issue

https://github.com/kornia/kornia/blob/b5418d8bac9e7bb01e66310d7d2b4227766c5a02/kornia/geometry/conversions.py#L682

def angle_axis_to_quaternion(angle_axis: torch.Tensor) -> torch.Tensor:
    r"""Convert an angle axis to a quaternion.
    The quaternion vector has components in (x, y, z, w) format.               # <-- says (x, y, z, w)
    # ...
    return torch.cat([w, quaternion], dim=-1)                                  # <-- does (w, x, y, z)

proposal:

return torch.cat([quaternion, w], dim=-1)

Similarly, in quaternion_to_angle_axis:

q1: torch.Tensor = quaternion[..., 0]
q2: torch.Tensor = quaternion[..., 1]
q3: torch.Tensor = quaternion[..., 2]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
schuhschuhcommented, Mar 31, 2021

I didn’t realize the convention was inconsistent with other quaternion related functions in kornia itself. In this case this should be flagged as bug maybe rather than enhancement?

0reactions
edgarribacommented, Apr 5, 2021

@amonszpart @schuhschuh let’s follow ceres convention [w, x, y, z] - we should also explain somewhere in the docs quaternion definition. There was even a proposal from @versatran01 to have a separated module similar to pyquaternion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

kornia.geometry.conversions - Read the Docs
Tensor: r"""Convert 3d vector of axis-angle rotation to 3x3 rotation matrix. ... WXYZ) return quaternion_to_angle_axis(quaternion, ... WXYZ` instead.
Read more >
Conversion between quaternions and Euler angles - Wikipedia
Spatial rotations in three dimensions can be parametrized using both Euler angles and unit quaternions. This article explains how to convert between the...
Read more >
kornia/conversions.py at master - GitHub
r"""Convert 3d vector of axis-angle rotation to 3x3 rotation matrix. ... WXYZ). return quaternion_to_angle_axis(quaternion ... WXYZ` instead.".
Read more >
Why you changed from Quaternion WXYZ to XYZ Euler
Suppose you use XYZ Euler and rotate an Object +/- 90°, then you have what is called Gimbal lock; rotating around the X-axis:....
Read more >
Scripting API: Quaternion.w - Unity - Manual
Quaternion -w script example // Create a Sphere and apply a texture to help ... void Awake() { // Add a line that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found