Thread: RE: [Algorithms] Extracting scale from matrix
Brought to you by:
vexxed72
From: Salah E. N. <se...@ub...> - 2000-09-06 18:22:44
|
well, you can extract a scale, but it will not always be a diagonal scale, it will look like R*S*R' where R is a rotation R' her transpose and S a diagonal matrix here's how: - The singular value decomposition theorem tells us that for avery matrix A, there exists two orthogonal matrices R and T, and a diagonal matrix S such that: A=R*S*T. what we want is to find a decomposition looking like: A=R1*(R2*S*R2'). R1 is the rotation part of A, and (R2*S*R2') is the scale part. so R=R1*R2 and T=R2', wich gives us R1=R*T and R2=T'. i don't have any algorithm to find the single value decomposition in mind,but you can try a search in www.google.com , i'm sure u'll find something out there. hope this helps. -----Message d'origine----- De: Jon Anderson [mailto:jan...@on...] Date: Wednesday, September 06, 2000 4:33 PM À: gda...@li... Objet: [Algorithms] Extracting scale from matrix Are there any good tricks for extracting the scale (x, y, z) from a 4x4 matrix? It seems pretty trivial to do it for matrices that consist of rotations about a single axis, but I'm having problems doing it for more complex matrices. Jon _______________________________________________ GDAlgorithms-list mailing list GDA...@li... http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |
From: <bse...@ro...> - 2000-09-07 18:53:04
|
Isn't there a DecomposeMatrix routine in one of the Graphics Gems? Pass it a 4x4 matrix and it returns rotation, scale, translation, shear and probably something more... ...yeah, it's at page 207 of Graphics Gems 4. -Blake -----Original Message----- From: Neal Tringham [mailto:ne...@ps...] Sent: Thursday, September 07, 2000 10:18 AM To: gda...@li... Subject: Re: [Algorithms] Extracting scale from matrix De: Jon Anderson [mailto:jan...@on...] >Are there any good tricks for extracting the scale (x, y, z) from a 4x4 >matrix? It seems pretty trivial to do it for matrices that consist of >rotations about a single axis, but I'm having problems doing it for more >complex matrices. If your matrix contains only rotation, scale and translation information, could you extract the scale factors by comparing the length of the basis vectors to the length of the normalised basis vectors? Note that (even if this works:-)) I don't believe it would allow you to distinguish between a negative sign in a scale factor (a "mirror") and a rotation, i.e. it would only allow you to extract the magnitude of the scale factors, not their signs. Curious as to people's comments on this... Neal Tringham (Sick Puppies) ne...@ps... ne...@em... _______________________________________________ GDAlgorithms-list mailing list GDA...@li... http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |
From: Jon A. <jan...@on...> - 2000-09-07 21:38:53
|
Thanks. I found it here: http://www.acm.org/tog/GraphicsGems/category.html which incidently lists it as Graphics Gems II, p. 320-323... =) Jon At 11:51 AM 9/7/2000 -0700, you wrote: >Isn't there a DecomposeMatrix routine in one of the Graphics Gems? > >Pass it a 4x4 matrix and it returns rotation, scale, translation, >shear and probably something more... > >...yeah, it's at page 207 of Graphics Gems 4. > >-Blake > > >-----Original Message----- >From: Neal Tringham [mailto:ne...@ps...] >Sent: Thursday, September 07, 2000 10:18 AM >To: gda...@li... >Subject: Re: [Algorithms] Extracting scale from matrix > > > >De: Jon Anderson [mailto:jan...@on...] > > >Are there any good tricks for extracting the scale (x, y, z) from a 4x4 > >matrix? It seems pretty trivial to do it for matrices that consist of > >rotations about a single axis, but I'm having problems doing it for more > >complex matrices. > >If your matrix contains only rotation, scale and translation information, >could you extract the scale factors by comparing the length of the basis >vectors to the length of the normalised basis vectors? > >Note that (even if this works:-)) I don't believe it would allow you to >distinguish between a negative sign in a scale factor (a "mirror") and a >rotation, i.e. it would only allow you to extract the magnitude of the scale >factors, not their signs. > >Curious as to people's comments on this... > >Neal Tringham (Sick Puppies) > >ne...@ps... >ne...@em... > > > > >_______________________________________________ >GDAlgorithms-list mailing list >GDA...@li... >http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list >_______________________________________________ >GDAlgorithms-list mailing list >GDA...@li... >http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |
From: Brown, G. <Br...@ct...> - 2000-09-07 20:33:17
|
> An implementation can be found in the MAX SDK, in Decomp.cpp > (this is the > source code for the famous decomp_affine method of the MAX SDK). > Unfortunately the code is really ugly, and I think it's even > not included in > the standard SDK (which only contains headers IIRC). There is a bug in this code that will not handle left hand matrices (I think). There is a new source posted somewhere in the MAX help file. I can dig it up if anyone needs it. |
From: Pierre T. <p.t...@wa...> - 2000-09-07 22:34:31
|
It would be interesting, yes... ----- Original Message ----- From: Brown, Greg <Br...@ct...> To: <gda...@li...> Sent: Thursday, September 07, 2000 10:35 PM Subject: RE: [Algorithms] Extracting scale from matrix > > An implementation can be found in the MAX SDK, in Decomp.cpp > > (this is the > > source code for the famous decomp_affine method of the MAX SDK). > > Unfortunately the code is really ugly, and I think it's even > > not included in > > the standard SDK (which only contains headers IIRC). > > There is a bug in this code that will not handle left hand matrices (I > think). There is a new source posted somewhere in the MAX help file. I can > dig it up if anyone needs it. > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |
From: Dave E. <eb...@ma...> - 2000-09-08 05:03:21
|
From: "Pierre Terdiman" <p.t...@wa...> > It would be interesting, yes... Another source for SVD is my code MgcMatrix3.* at the MgcCore.html page. This implements the algorithm from Golub's book (mentioned in this thread). For the original poster, if your matrix was computed as a sequence of matrices, each having translation, rotation, and a uniform scale, then the final product must also have only uniform scale. As someone else pointed out in this thread, in this case you can just look at the length of the first column of the 3x3 portion of the homogeneous matrix to get the scale, then normalize the three columns. You should then have a rotation matrix. -- Dave Eberly eb...@ma... http://www.magic-software.com |
From: Neal T. <ne...@ps...> - 2000-09-07 17:15:52
|
De: Jon Anderson [mailto:jan...@on...] >Are there any good tricks for extracting the scale (x, y, z) from a 4x4 >matrix? It seems pretty trivial to do it for matrices that consist of >rotations about a single axis, but I'm having problems doing it for more >complex matrices. If your matrix contains only rotation, scale and translation information, could you extract the scale factors by comparing the length of the basis vectors to the length of the normalised basis vectors? Note that (even if this works:-)) I don't believe it would allow you to distinguish between a negative sign in a scale factor (a "mirror") and a rotation, i.e. it would only allow you to extract the magnitude of the scale factors, not their signs. Curious as to people's comments on this... Neal Tringham (Sick Puppies) ne...@ps... ne...@em... |
From: Pierre T. <p.t...@wa...> - 2000-09-07 18:58:28
|
This is a classic problem whose solution is described in: Matrix Animation and Polar Decomposition - Ken Shoemake and Tom Duff. (Proceedings of Graphics Interface 1992.) An implementation can be found in the MAX SDK, in Decomp.cpp (this is the source code for the famous decomp_affine method of the MAX SDK). Unfortunately the code is really ugly, and I think it's even not included in the standard SDK (which only contains headers IIRC). To extract the scale they use a spectral decomposition as described in: Gene H. Golub and Charles F. Van Loan. Matrix Computations. Hopkins 1983. Pierre ----- Original Message ----- From: Neal Tringham <ne...@ps...> To: <gda...@li...> Sent: Thursday, September 07, 2000 7:17 PM Subject: Re: [Algorithms] Extracting scale from matrix > > De: Jon Anderson [mailto:jan...@on...] > > >Are there any good tricks for extracting the scale (x, y, z) from a 4x4 > >matrix? It seems pretty trivial to do it for matrices that consist of > >rotations about a single axis, but I'm having problems doing it for more > >complex matrices. > > If your matrix contains only rotation, scale and translation information, > could you extract the scale factors by comparing the length of the basis > vectors to the length of the normalised basis vectors? > > Note that (even if this works:-)) I don't believe it would allow you to > distinguish between a negative sign in a scale factor (a "mirror") and a > rotation, i.e. it would only allow you to extract the magnitude of the scale > factors, not their signs. > > Curious as to people's comments on this... > > Neal Tringham (Sick Puppies) > > ne...@ps... > ne...@em... > > > > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list |