Board index » delphi » Extracting a Matrix ?
Alexander Adam
Delphi Developer |
Alexander Adam
Delphi Developer |
Extracting a Matrix ?2003-11-02 08:56:33 AM delphi174 hi there, I have a matrix (3x3) written as TMatrix = Array[0..5] of Single. Now I want to extract all components of that matrix (there could be a translation, scaling, rotation and skewing x/y). How to get them with their values ? Something that outputs somethin' like translate 100 50 scale 0.2 0.56 translate 40 0 rotate 30 .... thanks for any help, alex |
Nils Haeck
Delphi Developer |
2003-11-03 12:24:17 AM
Re:Extracting a Matrix ?
A 3x3 matrix holds 9 elements. your array [0..5] holds 6 elements!
Try to find out first how the elements map to the matrix. It is probably a 3x2 matrix.. The last column represents translation, the 2x2 part represents scaling and rotation. Kind regards, Nils "Alexander Adam" <XXXX@XXXXX.COM>writes Quotehi there, |
Alexander Adam
Delphi Developer |
2003-11-03 12:51:58 AM
Re:Extracting a Matrix ?
Nils,
"Nils Haeck" <XXXX@XXXXX.COM>schrieb im Newsbeitrag QuoteA 3x3 matrix holds 9 elements. your array [0..5] holds 6 elements! transformations in their order, like scale 0.2, 0.5 translate 200 100 rotate() .... how to do that? My goal is that I have a matrix for the transformation of a shape in GDI+. (A Rectangle). Now I want to remove the matrix and apply it before to the rect's x,y and width/Height attributes as long as there's no rotation/skewing on it. It must stay at the same place as before.. alex |
Eric Grange
Delphi Developer |
2003-11-03 04:11:53 PM
Re:Extracting a Matrix ?
There is a "MatrixDecompose" in VectorGeometry.pas
cvs.sourceforge.net/viewcvs.py/glscene/Source/Base/VectorGeometry.pas It's for 3D (4x4 matrices), just extend your 3x3 matrix, and it could do what you're after (or just you may find ideas from the code fro a 3x3 version). Eric |