{"id":55,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/quaternion-operations\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"quaternion-operations","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/quaternion-operations\/","title":{"rendered":"Quaternion Operations"},"content":{"rendered":"

Quaternions can be treated simply as four-dimensional vectors for the purposes of addition, subtraction, and scalar multiplication. Quater\u00adnion addition is exactly the same as vector addition, meaning you simply add the components of the first quaternion to the correspond\u00ading components of the second one. The same is true for subtraction, although of course you subtract the components instead of add them.<\/p>\n

Scalar multiplication of quaternions also follows the same path as vectors. Each of the four components in the quaternion is multiplied by the scalar. Figure 2.2 shows an example of both addition and scalar multiplication.<\/p>\n

q = [1 2 3 4] p=[5 6 7 8] q + p=[6 8 10 12]<\/p>\n

2p = [2 4 6 8]<\/p>\n

Figure 2.2 An example of quaternion addition and scalar multiplication.<\/p>\n

Although not used directly in 3D programming, both of these operations are needed later, when you interpolate between two quaternions.<\/p>\n

Two other important qualities quaternions share with vectors is the way their magnitude is calculated, and the way a unit quaternion is calcu\u00adlated. As with vectors, to calculate the magnitude of a quaternion, you square each component of the quaternion, add them all together, and take the square root of the result.<\/p>\n

A quaternion does not become a \u201crotation quaternion\u201d (a quaternion representing a rotation) unless it is a unit quaternion. A unit quaternion is the same as a unit vector. A unit quaternion has a magnitude of exactly one, no more, no less. You can convert any quaternion to a unit quaternion by dividing each of the components by the total magnitude.<\/p>\n\n\n
\n

\"Quaternion<\/p>\n

Ly-l"-1 \u2014^ ‘ lT<\/p>\n

Unless your quaternion has a magnitude of one, it does not represent a rotation. If you find yourself with a quaternion without a magnitude of one, other than in the middle of an interpolation, you have probably done something wrong.<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

Quaternions can be treated simply as four-dimensional vectors for the purposes of addition, subtraction, and scalar multiplication. Quater\u00adnion addition is exactly the same as vector addition, meaning you simply add the components of the first quaternion to the correspond\u00ading components of the second one. The same is true for subtraction, although of course you subtract […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/55"}],"collection":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/comments?post=55"}],"version-history":[{"count":0,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/55\/revisions"}],"wp:attachment":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/media?parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/categories?post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/tags?post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}