From: kevin m. <ke...@su...> - 2005-07-11 12:26:43
|
I think when there is a scale in the matrix, that the quat you get is not a rotation quat. a rotation quat by definition is unit length == 1. having the scale in the matrix no longer means you're encoding pure rotation, now you've got something more, rotation plus scale. translation works because it's a completely separate part of the matrix, and so isn't read during the conversion. the scale however (as i'm sure you know) exists in the same values that encode rotation (the upper left 3x3 coordinate axes). separating scale from the rotation in a matrix that encodes both is slightly ambiguous, and apparently not supported by the well known mat->quat algorithms found in the books and websites we used as reference to write this code. I've never seen a variation on this algorithm, though that doesn't mean it's not doable.... for now if you do want scale you'll have to keep your scale matrix separated out from your other transforms... (basically get your rotation quat _before_ you compose your scale matrix into your matrix transform). *--*---*---*----*-----*------*------*-----*----*---*---*--* Kevin Meinert /_/ http://www.subatomicglue.com \ / \/ __ \/ \__ \_\ > Hello, > I am using gmtl 0.4.9. If I try to create a quat from this matrix I > get the following: > > | 0.5 -0.866025 0 0 | > | 0.866025 0.5 0 0 | > | 0 0 1 0 | > | 0 0 0 1 | > > quat > (0, 0, 0.5, 0.866025) > > Which gives me the correct end rotation. Now, if I take the same matrix > from above and apply a scale of 3 I get the following: > > | 1.5 -2.59808 0 0 | > | 2.59808 1.5 0 0 | > | 0 0 3 0 | > | 0 0 0 1 | > > quat > (0, 0, 0.981981, 1.32288) > > Which ends up over rotating by what appears to be a few degrees. It is my > understanding that I should be able to create a quat with a matrix that > does have scale on it, correct? > > Thanks for the help. > > Doug > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the 'Do More With Dual!' webinar > happening > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual > core and dual graphics technology at this free one hour event hosted by > HP, > AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar > _______________________________________________ > ggt-devel mailing list > ggt...@li... > https://lists.sourceforge.net/lists/listinfo/ggt-devel > |