Rotation representation
星期四, 31. 八月 2017 03:28下午
Outline
Rotation representation
OutlineRollpitchyawQuaternions
Definition Rules Quaternions and Rotations Geometric Explanation of Quaternions Applications Spherical Linear intERPolationSLERP
Roll,pitch,yaw
roll: 翻滚 沿着x轴旋转 pitch: 倾斜,坠落 沿着y轴旋转 yaw: 偏航 沿着z轴旋转
Quaternions
* Definition:
i
2 = j
2 = k
2 =-1ij = k, jk = i, ki = j, ji = -k, kj = -i, ik = -jq = s + x i + y j + z k
* Rules:
q1 q2 ≠ q2 q1(q1 q2) q3 = q1 (q2 q3)(q1 + q2) q3 = q1 q3 + q2 q3q1 (q2 + q3) = q1 q2 + q1 q3α (q1 + q2) = α q1 + α q2 (α is scalar)(αq1) q2 = α (q1q2) = q1 (αq2) (α is scalar)Norm: |q|
2= s
2 + x
2 + y
2 + z
2 (|q|
2 != q*q= s
2 - x
2 - y
2 -z
2+2s(xi+yj+zk))Conjugate: q* = s-xi-yj-zkInverse: q
-1=q*/|q|
2unit quaternion: |q| = 1 –> q
-1= q*
* Quaternions and Rotations
Rotations are represented by unit quaternions. |q|2= s2 + x2 + y2 + z2 = 1
Let (unit) rotation axis be [ux, uy, uz], and angle θ
Corresponding quaternion is q = cos(θ/2) + sin(θ/2)uxi+sin(θ/2)uyj+sin(θ/2)uzk Composition of rotations q1 and q2: q = q2 q1
≠
q1 q2(not commute)
Quaternion-xyzw: x = ux * sin(θ / 2) y = uy * sin(θ / 2) z = uz * sin(θ / 2) w = cos(θ / 2)
Let v be a (3-dim) vector and let q be a unit quaternion: the corresponding rotation transforms vector v to q v q-1 ,where v = 0+xi+yj+zk = [i,j,k] * [x;y;z] q v q-1 = [i,j,k] *(R [x;y;z]) (s化为0了)
For q = a+bi+cj+dk, R can be expressed as below… Quaternions q and -q give the same rotation
* Geometric Explanation of Quaternions
A quaternion is a point on the 4-D unit sphere.Interpolating rotations corresponds to curves on the 4-D sphere (两点+圆心总能作出一个圆,由该圆为大圆可以得到一个球,该大圆的法线方向为旋转轴,两点的弧对应的角度为绕该轴的旋转角,这些是最开始定义中,q = cos(θ/2) + sin(θ/2)u
xi+sin(θ/2)u
yj+sin(θ/2)u
zk 里面的u
x u
y u
z 和θ)
* Applications: Spherical Linear intERPolation(SLERP)
Situation:Interpolate along the great circle on the 4-D unit sphere(changing from one rotation state to another)Solution: pick the shortest(SLERP) cos(θ)=q1q2 =s1s2+x1x2+y1y2+z1z2 u: from 0–>1 q
m = s
m + x
m i + y
m j + z
m k, m =1,2 The above formula does not produce a unit quaternion and must be normalized, replace q by q / |q|Realization: Improvement: To be more smooth:combined with spline.
From http://run.usc.edu/cs520-s12/quaternions/quaternions-cs520.pdf