Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


How to re-orthogonalise vectors


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#21 Norman Barrows   Crossbones+   -  Reputation: 2349

Like
1Likes
Like

Posted 07 April 2013 - 05:22 PM

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

 

 


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS