Would anyone have code or a simple explanation on the process to rotate a vector by a quaternion?
I've tried Chroma's code here ( http://www.blitzbasic.com/codearcs/codearcs.php?code=1550 ) but it returns a quaternion and I'm expecting that a rotated vector should be a vector. Also, if I ignore the n (n? w, surely? ) component and just use the x,y and z, it doesn't give me the expected result. Unless I misread it anyway.
I also tried the explanation here ( http://www.sacredsoftware.net/tutorials/Quaternions/Quaternions.xhtml ) but although it's a beautifully simple explanation, it's virtually impossible to follow when debugging because it asks you to start by creating a quaternion value which is invalid. So I can't possibly imagine what's going to happen when I start doing math with that invalid quaternion. And if I don't know what the value should be, I can't hope to spot where I've gone wrong.
I've tried Chroma's code here ( http://www.blitzbasic.com/codearcs/codearcs.php?code=1550 ) but it returns a quaternion and I'm expecting that a rotated vector should be a vector. Also, if I ignore the n (n? w, surely? ) component and just use the x,y and z, it doesn't give me the expected result. Unless I misread it anyway.
I also tried the explanation here ( http://www.sacredsoftware.net/tutorials/Quaternions/Quaternions.xhtml ) but although it's a beautifully simple explanation, it's virtually impossible to follow when debugging because it asks you to start by creating a quaternion value which is invalid. So I can't possibly imagine what's going to happen when I start doing math with that invalid quaternion. And if I don't know what the value should be, I can't hope to spot where I've gone wrong.