티스토리 뷰

How do you measure the rotation difference by computing the difference of two quarternions?

To measure the rotation difference between two quaternions, you can compute the relative rotation, which tells you how much one quaternion rotates relative to the other. Here's the step-by-step process:

What is the difference between quaternion and axis-angle?

Quaternions and axis-angle representations are both used to describe rotations in 3D space, but they do so in different ways, with distinct mathematical formulations and properties. Here's a breakdown of the differences: 

Why does quaternion prevent gimbal lock? 

Gimbal lock is a phenomenon that occurs when using Euler angles to represent 3D rotations. It happens when two of the three rotational axes become aligned, causing the loss of one degree of rotational freedom and leading to ambiguous or unpredictable behavior.

Understanding Gimbal Lock with Euler Angles

  • Euler Angles: Represent rotation as a sequence of three rotations around the principal axes (typically , , and z). For example, you might have three angles α\alpha, β\beta, and γ\gamma representing rotations around the x-axis, -axis, and z-axis, respectively.
  • Gimbal Lock: When two of the three rotation axes align (e.g., when the pitch is 90 degrees), one of the degrees of freedom is lost. As a result, you can no longer rotate independently around all three axes, leading to issues in rotation control.

How Quaternions Prevent Gimbal Lock

Quaternions avoid gimbal lock because they represent rotations in a way that does not rely on sequential rotations around specific axes.

  1. Four-Dimensional Representation:
    • A quaternion is a four-dimensional vector q=w+xi+yj+zkq = w + xi + yj + zk with the constraint that w2+x2+y2+z2=1w^2 + x^2 + y^2 + z^2 = 1 (for unit quaternions representing rotations).
    • Instead of representing rotation as a sequence of angles around specific axes, quaternions encode the rotation as a single operation.
  2. Single, Unified Rotation:
    • When applying a quaternion rotation, the rotation is treated as a single operation that affects the entire 3D space uniformly, rather than as three separate rotations. This unified approach avoids the problem of axis alignment that leads to gimbal lock.
  3. No Sequence Dependency:
    • Euler angles are sequence-dependent, meaning that the order in which you apply rotations matters. This can lead to gimbal lock if two axes become aligned.
    • Quaternions, on the other hand, do not rely on the order of rotations around specific axes. The rotation represented by a quaternion is independent of any particular axis order, so the problematic alignment that causes gimbal lock never occurs.
  4. Smooth Interpolation:
    • Quaternions allow for smooth interpolation between rotations (using spherical linear interpolation, or slerp). This is difficult to achieve with Euler angles because of the risk of gimbal lock. With quaternions, the interpolation between rotations is smooth and continuous, avoiding sudden changes in rotation that gimbal lock can cause.

Summary

Quaternions prevent gimbal lock by representing rotations in a four-dimensional space, where rotations are not tied to sequential rotations around specific axes. This avoids the problematic alignment of axes that causes gimbal lock, allowing for continuous and smooth rotations in 3D space without losing degrees of freedom.

 

When the pitch is 90 degrees, why does Gimbal lock occur?

Gimbal locked airplane. When the pitch (green) and yaw (magenta) gimbals become aligned, changes to roll (blue) and yaw apply the same rotation to the airplane. - wikipedia

 

How do you interpolate two quarternions? 

Interpolating between two quaternions is commonly done using Spherical Linear Interpolation (SLERP). SLERP provides a smooth rotation that takes into account the shortest path between the two quaternions on the 4D unit sphere. Here's how you can perform SLERP:

Why the scalar angle difference defined up there and the angle between the two quaternions, which is arccosine of the dot product here are different?

The scalar angle difference derived from the quaternion difference (as described earlier) and the angle derived from the dot product of two quaternions serve different purposes and are calculated differently, leading to them not being directly comparable.

 

How do you apply axis-angle rotation and quaternion to 3d points?

Summary

  • Axis-Angle Rotation: Uses Rodrigues' rotation formula, which directly computes the rotated point using trigonometric functions, cross products, and dot products.

  • Quaternion Rotation: Converts the point into a quaternion, applies quaternion multiplication, and extracts the vector part of the resulting quaternion.

Both methods achieve the same goal: rotating a 3D point around an axis by a specified angle, but they do so in different mathematical frameworks. The quaternion method is often preferred in computer graphics and robotics due to its numerical stability and ability to avoid gimbal lock.

 
 

 

 

 

'Research (연구 관련)' 카테고리의 다른 글

VNC,vglrun, simulation, forwarding  (0) 2024.09.07
HuMoR  (0) 2024.09.06
Capture data from ARIA glasses  (0) 2024.08.30
SSH from Remote  (0) 2024.08.30
HHF Part10 - Applied Aspects of Hand Function  (0) 2024.08.27
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함