Quaternion, Euler angle study notes & personal understanding


1. Background knowledge: complex number multiplication and vector inner product and outer product

Insert picture description here
          The definitions of i, j, and k are shown in the figure above. Satisfy the right-hand spiral rule:
Insert picture description here
          multiplication of complex numbers: (ai+bj+ck)×(xi+yj+zk)=(ax)i×i+(ay)i×j+(az)i×k+(bx)j×i+ (by)j×j+(bz)j×k+(cx)k×i+(cy)k×j+(cz)k×k = -(a a+b b+c*c)+(bz-cy)i+ (cx-az)j+(ay-bx)z
          vector inner product: (a,b,c)·(x,y,z) = ax+by+cz
          vector outer product: (a,b,c)×(x,y,z) = ax+by+cz
(e1, e2, e3 are i respectively The unit vector on the three axes of, j and k)
          can be seen from this:
complex multiplication (ai+bj+ck)×(xi+yj+zk)=-(vector inner product)+(vector outer product) [formally equal]

2. Two-dimensional complex numbers represent rotation

         Two-dimensional complex numbers can represent rotation on a two-dimensional plane.

         For example: define the complex number to be rotated p=2+i, define the rotation factor q=cos45+isin45
, Insert picture description here
  as shown in the figure below, the
Insert picture description here
          rotation factor q is multiplied by the rotated complex number p to indicate that p is rotated 45° counterclockwise.

3. Why three-dimensional rotation is represented by four-dimensional complex numbers instead of three-dimensional complex numbers

See the original post:

https://blog.csdn.net/u011760195/article/details/85346704

          If the real axis x and ij are used to represent the rotation factor q and the rotated complex number p, then when p rotates around a certain axis, there are:

The x-axis rotates around the j-axis: x×(a+bi) [j does not appear]
The i axis rotates around the x axis: i×(a+bj) [x does not appear]

        At this time, there will be a problem. The term i×j does not represent the real axis x because there is no regulation. i×i=-1 is possible, but i×j is not a real number. Therefore, although the i, j, and x axes are perpendicular to each other, they cannot be represented by cross multiplication, which does not meet the calculation requirements. Therefore, the four-dimensional complex number (quaternion) is introduced, and an imaginary axis k is introduced on the basis of the three-dimensional complex number, and the real axis x=0 is concealed. At this time, the three ijk axes satisfy the mutual representation of the cross product (right-hand spiral rule).
          Therefore, the replacement of three-dimensional complex numbers with four-dimensional complex numbers is only because the real axis x cannot be represented by i×j, which does not meet the calculation requirements. Set the real part of a four-dimensional complex number to zero, which is four-dimensional in form, but three-dimensional when actually used. The real part is not needed.
         Think from another perspective: (For example, when the converted complex number p=2 contains only the real part, this point can be said to be a point on a one-dimensional axis, or a point in a two-dimensional plane. A low-dimensional point, Lines, surfaces, etc. can exist in their own dimensions, and can also exist in any higher dimensions.) In two dimensions, the rotation factor q=a+bi can change the original one-dimensional point on the real axis. Turn into a two-dimensional plane. Multiplying a complex number in several dimensions means rotating in several dimensions. For example, multiplying a complex number in four dimensions means rotating in a four-dimensional space. However, rotation does not necessarily transfer the one-dimensional p on the real axis to the two-dimensional plane. For example, if p=2 on the two-dimensional plane and the rotation factor is defined as q=3, then p and q can be regarded as imaginary parts For a two-dimensional complex number of 0, the rotation at this time is p'=q×p=6, and the rotation at this time is only on the real axis and does not turn p into the two-dimensional plane. The rotation in the three-dimensional space represented by the quaternion is also the same. p is a pure quaternion, the real part is 0, and it is a vector in the real three-dimensional space. We multiply p by another quaternion q Time is actually a rotation in four-dimensional space, but just like on a two-dimensional plane, we can in some way keep the rotation of p only in three-dimensional space and not turn to four-dimensional space.
          In addition, quoted from:

https://blog.csdn.net/linyijiong/article/details/79777399

…So from beginning to end, quaternion defines four-dimensional rotation, not three-dimensional rotation! ...To put it bluntly, three-dimensional rotation is a special case of four-dimensional rotation, just as two-dimensional rotation is a special case of three-dimensional rotation. ……Qpq-1 is the expression of multiplying the unit quaternion on the left and its conjugate on the right...... This operation form is to limit the space where the result of the operation lies. Simply put, when we perform a three-dimensional rotation on a three-dimensional vector, what we hope to get is a three-dimensional vector. ……Then this operation of multiplying the unit quaternion on the left and its conjugate on the right ensures that the result is a pure quaternion in the three-dimensional hyperplane.

Four, the written representation of quaternion

          Let the quaternion be expressed as: [s,v], where s is a real number, which is the real part of the quaternion. v is a 3-dimensional vector (or as a 3-dimensional pure imaginary number), v=xi+yj+zk. The quaternion multiplication calculation is: q1×q2=[sa, va]×[sb, vb]=[sa•sb+va•vb, sa•vb+sb•va+va×vb]
          Definition:
         unit four Yuan: q=[s, v],|q|=1
          Pure quaternion: q=[0, v], that is, the real part is 0, which is a vector in a three-dimensional space

Five, quaternion represents rotation

See the original post:

https://blog.csdn.net/linyijiong/article/details/79777399

          In the two-dimensional space, the rotation factor q=cosθ+sinθi is expressed by the quaternion in the previous part. The two-dimensional rotation factor can also be expressed as q=[ cosθ,sinθv], where v is a one-dimensional pure imaginary number, v =i. Since four-dimensional complex numbers are used to represent rotation in three-dimensional space, the rotation factor can also be defined as: q=[ cosθ,sinθv], where v is a three-dimensional pure imaginary number, v=ai+bj+cz. ( Leave a question: q can be drawn on a two-dimensional plane, what about this q in three-dimensional space? ) The
          existing pure quaternion form where a rotated three-dimensional complex number is written in four dimensions: p=[0,p], rotation factor q=[ cosθ,sinθv], then p'=q×p=[ sinθv•p, cosθ•p+ sinθv×p]
          ①When v and p are orthogonal, rotate 45° around v, then p'=[ 0, cosθ•p+ sinθv× p]
          Example: p=[0,2i] q=[√2/2,√2/2 v], for v and p to be orthogonal, might as well set v=k,
          then p'=[0, √2i+√2k ×i]=[0, √2i+√2j], the rotation process is as shown in the figure below, and the rotation is 45° around the k axis.
Insert picture description here
          ② When v and p are not orthogonal, rotate 45° around v, then p'=[ sinθv•p, cosθ•p+ sinθv×p] For
          example: p=[0,2i] unchanged, q=[√2/2 ,√2/2 v], in order that v and p are not orthogonal, we might as well set v= √2/2 i+√2/2 k, then
calculate p'=q×p=[-1, √2i+j]
Insert picture description here
        It can be seen that the calculation result p'is no longer a pure quaternion. In fact, p is transformed into four-dimensional space by q, and the projection in the three-dimensional space of its pure imaginary number ijk is as shown in the figure above, the red p It is not rotated 45° around the rose red v= √2/2 i+√2/2 k, and |p'|≠2, which is stretched and deformed.
        At this time, Hamilton proposed a correction algorithm,
Insert picture description here
        so that p'=[0,i+√2j+k] can be calculated, as shown in the figure below.
Insert picture description here
        At this time, the rotated |p'|=2 is not stretched, but After turning 90° (the angle between the pv plane and the p'-v plane is 90, that is, the pv plane is rotated 90° counterclockwise around v), the angle has doubled, so it is further corrected to make
Insert picture description here

Six, quaternion → Euler angle

        See the original post:

https://www.cnblogs.com/kljfdsa/p/9093009.html

Insert picture description here
        The three-dimensional rotation in space can be regarded as the combination and superposition of rotations around three basic axes. The rotation angles of the three basic axes around x, y, z (representing the three axes i, j, and k respectively) are ϕ, θ, ψ, Then the four elements of the three basic rotations can be characterized as:
Insert picture description here
        the rotation order around the three basic axes is different, and the spatial rotation represented by it is also different. The following calculations are in the order of ZYX (here based on reference materials, and the previous few pieces of content The order of left multiplication and right multiplication is different, here is right multiplication, which means clockwise rotation):
Insert picture description here
        then when the quaternion is known, find the Euler angle in reverse:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44986556/article/details/108881052