## RE: [Algorithms] Quaternions or Matrices

 RE: [Algorithms] Quaternions or Matrices From: Tyson Jensen - 2003-02-28 19:49:00 ```REAL robust Matrices require 3 sqrts to re-orthonormalize. Why can REAL matrices just ignore this step but REAL quaternions have to have it? OTOH, the PS2 (modern example processor) does a 32-bit sqrt in 7 cycles (less than a divide!). It is well worth the time to browse every new processor manual for cycle counts on various operations. Your expensive operation assumptions need to change every rev if you want to stay on top of performance. The ability to quickly see what way something is facing is pretty important for lots of situations, and matrices have a clear edge there. Quaternions are best in situations where you need lots of rotations, no scales, no shears, and limited translations. Sounds like a description of a typical IK / animation problem.... In such cases I prefer to use quaternions. In graphics, the hardware is all matrix optimized so I'm sticking with matrices there. -----Original Message----- From: gdalgorithms-list-admin@... [mailto:gdalgorithms-list-admin@...] On Behalf Of Richard Fabian Sent: Friday, February 28, 2003 2:18 AM To: gdalgorithms-list@... Subject: RE: [Algorithms] Quaternions or Matrices four reasons I can think of why we don't use quaternions as matrix replacements: you cannot directly build a quaternion from pos, dir, up neither can you use the rows to show what way something is facing until you convert it to a matrix. quaternions do not require 51 mults and 39 adds... REAL robust quaternion code also takes a sqrt for normalising the S value, which we all know is not good for speed. s values can become degraded if you chain enough quats together at the wrong angles.. you try it, you will find you are getting artifacts at certain rotations... do the math, and find out that it is a REAL limitation of quaternions... and of course there is the fact that you sometimes have to make up new standards like how to store mirroring, scale, shear. (although mirroring can be simply the lowest bit in your s value) > -----Original Message----- > From: gdalgorithms-list-admin@... > [mailto:gdalgorithms-list-admin@...] On > Behalf Of Stefan Maton > Sent: 28 February 2003 09:49 > To: gdalgorithms-list@... > Subject: RE: [Algorithms] Quaternions or Matrices > > > > which gives a pointer to > > http://www.gamedev.net/reference/articles/article1199.asp > that has an > > interesting debate about this. > > Well, I don't think that helps me to understand why quaternions aren't > used more often. > > IMO the article doesn't take into account the effective number of > operations used to do a transformation. > > Using a 4x4 matrix (containing rotation, scaling and translation) > it takes 64 multiplications and 64 add operations to combine two > matrices (matrix multiplication). > > The same can be done with 51 multiplications and 39 add operations > using a quaternion and 2 vectors. > > Yes, there's a overhead because you have to convert the quaternion > into a matrix when passing it to OpenGL/DirectX but this takes 17 > mult and 15 add operations making it 68 mult and 54 add operations > to create a transformation matrix. > > Now, this doesn't make much benefit, if you only have the world and > one object to combine. But it makes a big difference when you do it > on a large number of objects. > > Kind regards, > Stefan > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithms-list mailing list GDAlgorithms-list@... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 ```