-
Senior Member
Matrix libs in as3?
We all know that each and every flash 3D engine comes with 4x4 matrix math code (and sometimes 3x3 operations included), but recently I ran into a problem solving equation involving 4x3 (and, obviously 3x4) matrices at runtime. Having no suitable code at hand, I resorted to mathcad symbolic solution in terms of numbers that make up these matrices; needless to say, implementing these expressions is not fun. So. Does anyone know solid matrix math library for as3 that can operate with matrices of any dimensions?
-
You can try this. I don't seem to remember ever testing it, so don't assume everything works! It's Flash 10
http://lab.generalrelativity.org/file/MatrixND.as
EDIT: Meh, looked at it, looks like it only has square matrix solvers...
Last edited by newblack; 06-11-2009 at 08:28 AM.
-
Senior Member
Interestingly enough, top google hits for non-square matrix inverse all say that there is no inverse for non-square matrices, and one should resort to LS/QR/SVD. If that's really so, I am puzzled how mathcad was able to find exact solution of my problem. Maybe I had a typo somewhere, but we'll see once I will implement it.
-
Senior Member
Yep, that was a typo, I missed few variables, hence no solution for me
-
that sucks... what are you trying to solve?
-
Senior Member
if you have to ask I was trying to solve for 3d coords from 2d coords of 3 points for sort of augmented reality experiment (but without flartoolkit), and I missed how their z-s remained in what I thought was solution, so I had to estimate z-s in some other way (I had some limited success here btw). I've found some article on homography that said it takes at least 4 points, which brings us back to 4x4 matrices, I guess, and more than 4 points naturally go with LS.
Last edited by realMakc; 06-12-2009 at 05:52 PM.
-
Senior Member
Originally Posted by newblack
I don't seem to remember ever testing it, so don't assume everything works!
I finally got back to this, and tested, and there's actually a bug or restriction of some sort in the code. Check it out here (scroll down to line 107), let me know what you think...
Last edited by realMakc; 09-08-2010 at 10:53 PM.
-
Senior Member
duhh, found the answer here:
If the matrix A is positive definite symmetric or if the matrix is diagonally dominant, then pivoting is not necessary; otherwise the version using pivoting should be used.
looks like I need to edit your code a bit more
-
Actionscript Developer
Actionscript 3 Matrix Library
K2xL - My games, tutorials, message boards, and experiments.
Blog
-
Senior Member
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|