How to re-orthogonalise vectors

Started by
19 comments, last by Norman Barrows 11 years ago

Is this the sort of thing that I'm after? I removed the current orthogonalising routine I've got (cross products, etc...) and put in the D3DXQuaternionNormalize() part.

this is very off the cuff here...

you want to do a D3DXQquaternionIidentity(myquat) to get your ship started out lined up with the world axes.

then its time to turn.

D3DXQuaternionYawPitchRoll(tmp_quat,yaw,pitch,roll)

D3DXQuatenarionMultiply(&myquat,&tmp_quat,&myquat);

then normalize

D3DXQuatenarionNormalize(&myquat,&myquat) // not sure if you can call it that way, might have to be &tmp,&myquat, followed my myquat=tmp.

i have yet to try quats myself, but when i was looking for all the pieces, these are what i found.

you can also use D3DXQuatenarionRotationAxis to do rotations about individual local axes, or any arbitrary axis.

when its time to draw or you need the equivalent matrix, you use

D3DXMatrixRotationQuatenarion(&myMat,&myquat);

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

This topic is closed to new replies.

Advertisement