A Flash Developer Resource Site

# Thread: Matrix libs in as3?

1. ## 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?

2. 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...

3. 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.

4. Yep, that was a typo, I missed few variables, hence no solution for me

5. that sucks... what are you trying to solve?

6. 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.

7. 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...

8. 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

9. ## Actionscript 3 Matrix Library

Here's an Actionscript 3 Matrix Library:
http://k2xl.com/wordpress/2010/12/27...atrix-library/

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

 » Home » Movies » Tutorials » Submissions » Board » Links » Reviews » Feedback » Gallery » Fonts » The Lounge » Sound Loops » Sound FX » About FK » Sitemap