## Re: [Algorithms] Quaternions or Matrices

 Re: [Algorithms] Quaternions or Matrices From: Dean Calver - 2003-02-28 10:46:28 ```But a 4x4 matrix is more general than a rotation, scale and translation. Shears and projective transforms and other 'odd' transforms all fall neatly into the matrix case but not the quaternion case. 4x4 matrices are a superset of the transforms we use on a day to day basis, its handy to have that flexibility for when you need it. I once inherited an engine that use quats and 2 vectors to pass things into the renderer and the first thing we had to we replace it with 4x4 matrices, the reason being our animation system sometimes used shears and we wanted to use projection for simple shadows. Your not comparing like for like when comparing quats and 4x4 matrices, 4x4 matrices are very powerful objects. Unit quats are just rotations, that can be a good thing higher up but at the lowest level matrices are more general. Bye, Deano Dean Calver, Eclipse Studios. ----- Original Message ----- From: "Stefan Maton" To: Sent: Friday, February 28, 2003 9:48 AM 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 > > ```