### Author Topic: GLM quaternion  (Read 18434 times)

0 Members and 1 Guest are viewing this topic.

#### LangFox

• Associate
• Posts: 2
##### GLM quaternion
« on: February 27, 2009, 10:30:43 AM »
At first, I have to say that GLM is must-have for OpenGL developers.

But the quaternion could be optimized. It should be more efficient to make an axis-angle format and have a function to rotate vector.

Finally, great work! Yet it can be better!

#### Groove

• Soldier
• Posts: 51
##### Re: GLM quaternion
« Reply #1 on: March 17, 2009, 03:57:44 PM »
You have very welcome!

It actually depend how you use it. If you need to go back to the proper quaternion form, you lose a lot of benefice. If you really want to use a axis angle form, I think it would be better to simply use a vec3 and a scalar.

Have you some samples where you find advantages of axis-angle?

#### LangFox

• Associate
• Posts: 2
##### Re: GLM quaternion
« Reply #2 on: March 19, 2009, 07:51:18 AM »
Well, it is nothing important, just a little laziness, hehe.

My original math is:
Code: [Select]
`sm_quat q(axis, theta);vec3 result = q.rotate(v);`
`quat p(1.0, v.x, v.y, v.z);quat q(cos(theta/2), axis.x*sin(theta/2), axis.y*sin(theta/2), axis.z*sin(theta/2));quat result = cross(cross(q, p), conjugate(q));`