1 / 3

Quaternions

Quaternions. Hamilton conceived them as extended complex numbers One real portion ( s ) and three imaginary portions ( ai,bj,ck ) s + ai + bj + ck s is a purely real scaler a,b,c are real i 2 = j 2 = k 2 = -1 ij = k = -ji s 2 + a 2 + b 2 + c 2 = 1

rivka
Télécharger la présentation

Quaternions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Quaternions • Hamilton conceived them as extended complex numbers • One real portion (s) and three imaginary portions (ai,bj,ck) • s + ai + bj + ck • s is a purely real scaler • a,b,c are real • i2 = j2 = k2 = -1 • ij = k = -ji • s2 + a2 + b2 + c2 = 1 • s=cos(θ/2), a=sin(θ/2)x, b=sin(θ/2)y, c=sin(θ/2)z • Where (x,y,z) is a unit vector along axis of rotation • Usually write quaternion as [v,w] with v=(a,b,c)

  2. Why Quaternion Rotation? • Think of quaternion rotation as an enclosing sphere around an object. • By dragging the mouse along the sphere, the object is rotated • Ry(45)•Rx(90) not equal to Rx(90)•Ry(45) • Wouldn’t it be nice to rotate somewhere, and rotate right back? • Ry(180)•Rx(180) = Rz(180) • Now that’s confusing… • Instead of • glRotatef(θx, 1, 0, 0); • glRotatef(θy, 0, 1, 0); • glRotatef(θz, 0, 0, q); • Call once • Convert euler angle to quaternion • convert quaternion to axis angle • glRotatef(θ, x, y, z);

  3. | 1-2b2-2c2 2ab-2sc 2ac+2sb 0 | | 2ab+2sc 1-2a2-2c2 2bc-2sa 0 | | 2ac -2sb 2bc+2sa 1-2a2 -2b2 0 | | 0 0 0 1| Book rewrites the matrix using a unit quaternion x,y,z. Therefore x2+y2 + z2=1 (The book renames it ux uy uz ) Recall s=cos(θ/2), a=sin(θ/2)x, b=sin(θ/2)y, c=sin(θ/2)z now s=cos(θ/2), a=sin(θ/2) ux, b=sin(θ/2) uy, c=sin(θ/2) uz I will convert M11 of 5-107 to M11 of 5-108 Using geometric identities sin2(θ/2) = ½(1-cos θ), cos2(θ/2) = ½(1+cos θ) , 1-2 sin2(θ/2)=cos θ 1-2b2-2c2 =1-2 sin2(θ/2)y2- 2 sin2(θ/2) z2 = 1-2 sin2(θ/2)(y2 +z2) = 1-2 sin2(θ/2)(1-x2) = 1-2 sin2(θ/2) - 2 sin2(θ/2) x2 = cos θ – (2)½(1-cos θ) x2 = x2 (1-cos θ) + cos θ = ux (1-cos θ) + cos θ Quaternion Matrix

More Related