#### [SOLVED] What are the semantics of these quaternion functions in XNA/Monogame?

I am having trouble understanding the semantics of some members of the XNA/Monogame Quaternion class. The docs are not helpful, and tutorials trying to explain quaternions are using heavy math, which isn't helpful for me either, since I simply do not have proper background for that.

My main questions currently are:

• Is there any difference between Multiply and Concatenate?

• What is the exact difference between Inverse and Negate?

#### @Bálint 2019-01-08 13:34:56

There's minimal difference between concatenate and multiply, concatenate(a, b) = b * a

Inverse and negate are different. Negate flips the signs, inverse returns $$\q^{-1}\$$ so that $$\q * q^{-1} = identity = (1, 0, 0, 0)\$$, the inverse of the quaternion $$\(a, b, c, d)\$$ is $$\\frac{a -ib-jc-kd}{a^2+b^2+c^2+d^2}\$$

#### @DMGregory 2019-01-08 14:48:59

I'd expect Inverse({1/√2, 0, 0 1/√2}) to yield {-1/√2, 0, 0 1/√2} while Negate would yield {-1/√2, 0, 0 -1/√2}. These two rotations yield the same orientation, but the latter reaches it the long way rather than via the shortest angle.

#### @codymanix 2019-01-08 15:37:03

What is the semantic of normalizing a Quaternion, I understand that the components will divided by the length, but what happens to the rotation then?

#### @Bálint 2019-01-08 15:50:29

@codymanix Nothing, but multiplying other quaternions with a normalized one won't change their length. This won't be guaranteed for a non-normalized one

@DMGregory Fixed

#### @codymanix 2019-01-09 13:25:47

Does normalizing a Quaternion mean similar as make for example n*2*PI to 0.0 degrees in Euler angles? If this hasn't any drawbacks and does't affect rotation, is it recommended to normalize a Quaternion before persisting it (e.g. store into database)?

#### @Bálint 2019-01-09 14:48:20

@codymanix quaternions are 4d numbers, so basically a more complicated vector. Multiplying two quaternions results in one with a length equal to the factor of the first two. Since gamedevs generally use floats and those are more precise when they're smaller, it's advised to either normalize quaternions or only use unit length ones when multiplying

### How to apply blur effect to 2D textures using shaders?

• 2017-04-02 10:13:44
• user1306322
• 664 View
• 0 Score

### [SOLVED] [ C# ]xna to monogame

• 2014-04-26 17:55:55
• Mr.CodeIt
• 217 View
• 1 Score
• Tags:   xna java monogame