Quaternion * Vector3?

Problems building or running the engine, queries about how to use features etc.
Post Reply
Baldrake
Halfling
Posts: 63
Joined: Tue Apr 13, 2004 1:09 am

Quaternion * Vector3?

Post by Baldrake »

I've been reading up on quaternions. So far so good, but...

Ogre defines a '*' operation over a Quaternion and a Vector3, which doesn't seem to be a standard one. From the code, I can see that this is defined as:

Code: Select all

Let q=<x,y,z,w> be a quaternion and v be a vector in 3-space. Then:

q * v = v + 2w (<x,y,z> x v)
           + 2 (<x,y,z> x (<x,y,z> x v))
Ok, but what does this actually mean? Can someone give me the intuition behind this definition?

Thanks!
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 8
Contact:

Post by haffax »

Ogre's Quaternion operator* actually calculates q*v*q^1. Thus applying the rotation. There is no use for the mathematically correct multiplication as a stand-alone in a 3D application, because you only use it to apply the rotation anyway and you therefor had to call it twice with some float multiplications overhead.
team-pantheon programmer
creators of Rastullahs Lockenpracht
Post Reply