Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
www.Bookspar.com | Website for Students | VTU - Notes - Question Papers 6 Quaternion 6.1 Introduction We know that, complex numbers can be used to represent operations such as rotation in 2D. Suppose that, I denote the pure imaginary number let i denote the pure imaginary number i2 =-1 and we know that the euler’s identity ., eiθ =cosθ + i sinθ such that We can write the polar representation of a complex number c as c=a + ib = reiθ where, r= a 2 b2 and θ = tan-1 b/a If we rotate c about the origin by Φ to c’, then we can find c’ using rotation matrix or we can use polar representation c’ = rei(θ+Φ) = r eiθ eiΦ Where eiΦ is rotation operator in complex plane and is alternative to transformations However, in 3D it is difficult, because to specify a rotation about the origin we need to specify direction (a vector) and amount of rotation (a scalar), one Solution is, use a representation that consists of both a vector and scalar such a representation is Quaternion. 6.2 Quaternion Quaternion is an interesting mathematical concept with a deep relationship with the foundations of algebra and number theory. It was discovered by Hamilton in the year 1843.Quaternions are an extension of complex numbers that most useful for representing the orientation. A quaternion consists of Scalar part and vector part , Let a be the quaternion and is defined as www.BookSpar.com 1 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers a=(q0, q1, q2, q3) Where q=(q1, q2, q3) i.e., a = ( q0 , q) so, we can call Quaternion is an extension to complex numbers 6.2.1 Operations on Quaternions The operations among quaternions are based on the use of 3 complex numbers I, j and k with the properties i 2 j 2 k 2 ijk 1 i jk kj j ki ik k ij ji These three complex numbers are analogous to the unit vectors in 3D, and we can write q as q = q1i + q2j + q3k Quaternion addition and multiplication can be defined using the dot and cross product of vectors: let b = ( p0, p) and a = (q0, q) are the two quaternion, then a + b = (p0 + q0 , p + q) a*b = (p0q0 – q.p , q0p + p0q + q X p ) If p0=q0=0 then a*b = (q.p , q X p ) Note that Quaternion multiplication is not commutative, so a * b ≠ b * a a•b = (q0p0 + q•p) We can also define the magnitude of quaternion as a q02 q12 q22 q32 q02 q.q 2 Multiplicative identity for the quaternion is (1 , 0 ) and the inverse of a quaternion is given 1 a 1 ( q0 , q ) by 2 a a q02 q12 q 22 q32 1 www.BookSpar.com 2 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers unit quaternion is denoted by 6.2.2 Quaternion and Rotation Quaternions can also be used to carry out the rotation operations. Suppose , we use the vector part of the quaternion to represent the point in space, say p = ( 0, p) thus p = ( x, y ,z ) gives the location of point. Consider the quaternion r is unit quaternion. Therefore r cos , sin v where v is the unit length, so quaternion 2 2 r 1 cos , sin v 2 2 If we consider the quaternion product of the quaternion p that represent a point with r, we get the quaternion p | cos 2 2 p| rpr 1 this is of the form (0 , p| ) where p sin2 2 ( p.v)v 2 sin 2 cos 2 (v p ) sin 2 (v p ) v p| is the representation of a point. We can say that p| is the result of rotating the point p by an angle θ degree about the vector v. If we compare the general rotation as we are discussed earlier, the result is same and if we count the number of operations, quaternions are faster. Consider an Example, the rotation about the z - axis by θ with a fixed point at the origin. The desired unit vector v is (0 , 0 , 1 ) Then the quaternion is r cos 2 sin 2 (0,0,1) Rotation of an arbitrary point p = (x, y, z) yields the quaternion p| rpr 1 r (0, p)r | (0, p| ) Where p| ( x cos y sin , x sin y cos , z ) www.BookSpar.com 3 www.Bookspar.com | Website for Students | VTU - Notes - Question Papers This is the expected result with fewer operations If we consider a sequence of rotations about the coordinate axis that in matrix form yields the R Rx ( x ) R y ( y ) Rz ( z ) Instead of this, we can use product of the matrix corresponding quaternions to form rx.ry.rz (Quaternions can be used only for rotations ) 6.2.3 Convert quaternion to matrix form. We can use p | rpr 1 to find the elements of the homogeneous coordinate rotation matrix embedded in M, using the following matrix M= 2 2 1 2q 2 2q3 2q q 2q q 0 3 1 2 2q 1 q 3 2q 0 q 2 0 if 2q 1 q 2 2q 0 q 3 1 2q12 2q32 2q 2 q 3 2q 0 q 1 0 2q 1 q 3 2q 0 q 2 2q 2 q 3 2q 0 q 1 1 2q12 2q 22 0 0 0 0 1 r cos , sin v 2 2 Then, the rotation matrix R is 1 2 sin 2 (v y2 v z2 ) 2 sin 2 v x v y 2 cos sin v z 2 sin 2 v x v z 2 cos sin v y 2 2 2 2 2 2 2 2 2 2 2 2 1 2 sin (v x v z ) 2 sin v y v z 2 cos sin v x 2 sin v x v y 2 cos sin v z 2 2 2 2 2 2 2 2 sin 2 v v 2 cos sin v 2 sin 2 v v 2 cos sin v 1 2 sin 2 (v x2 v y2 ) x z y y z x 2 2 2 2 2 2 2 0 0 0 www.BookSpar.com 0 0 0 1 4